题解 | #倒置字符串#

倒置字符串

http://www.nowcoder.com/practice/ee5de2e7c45a46a090c1ced2fdc62355

s = input()
sum = len(s)
r = ""
j = sum
for i in range(0,sum):
    if s[sum - i - 1] == " ":
        r = r + " " + s[sum - i: j]
        j = sum - i - 1
r = r + " " + s[0:j]
print(r[1:len(r)])
全部评论

相关推荐

程序员猪皮:看不到八股什么意思
点赞 评论 收藏
分享
评论
1
收藏
分享
牛客网
牛客企业服务