题解 | #字符串排序#

单词倒排

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

s = input()
temp = ""
for i in s:
    d = ord(i)
    if (d >= 65 and d<=90) or (d >= 97 and d <= 122):
        temp = temp + i
    else:
        if temp != "":  # 防止第一个就是非字母而出现空格
            temp = temp + " "
temp_list = temp.split(" ")
for i in temp_list[::-1]:
    print(i, end=" ")
全部评论

相关推荐

醉蟀:你不干有的是人干
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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