题解 | #在字符串中找出连续最长的数字串#
单词倒排
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

查看5道真题和解析