题解 | #将真分数分解为埃及分数#

单词倒排

http://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836

终于全部刷完了。。最后一题纪念下自己写吧。。。,虽然弄得很复杂。

while True:
    try:
        s = input()[::-1]
        flag = 1
        res = ''
        for thing in s:
            if not thing.isalpha():
                flag = 0
                continue
            else:
                if flag == 0:
                    res+=' '+thing
                    flag = 1
                else:
                    res+=thing
        res = ' '.join(list(map(lambda x:x[::-1], res.split(' '))))
        print(res)
    except:
        break
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务