题解 | #单词倒排#

单词倒排

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

有点复杂


str_1=input()
a = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
str_2=''
for i in str_1:
    if i in a:
        str_2 += i
    else:
        if str_2 != '':
            if str_2[-1] !=' ':
                str_2 += ' '
str_2 = str_2.split(' ')[::-1]
print(' '.join(i for i in str_2))           
全部评论

相关推荐

牛客96931767...:这履历不是在网安横着走啊
大家都开始春招面试了吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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