题解 | #在字符串中找出连续最长的数字串#

单词倒排

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

# import sys
while True:
    try:
        s = input()
        words = []
        word = ''
        for c in s:
            if c.isalpha():
                word += c 
            else:
                if word != '':
                    words.append(word)
                    word = ''
        if word != '':
            words.append(word)
            word = ''
        print(' '.join(words[::-1]))
    except:
#         print(sys.exc_info())
        break





















全部评论

相关推荐

评论
点赞
收藏
分享
牛客网
牛客企业服务