题解 | #字符串最后一个单词的长度#
字符串最后一个单词的长度
https://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da
s=str(input()) new_s=s[::-1] count=0 for item in new_s: if item !=" ": count+=1 else: break print(count)
字符串最后一个单词的长度
https://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da
s=str(input()) new_s=s[::-1] count=0 for item in new_s: if item !=" ": count+=1 else: break print(count)
相关推荐