题解 | #字符串最后一个单词的长度#
字符串最后一个单词的长度
http://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da
str = input() list = [] i = 0 s = 0 while i < len(str): s = i while str[i] !=" " and str [i] not in[".",","]: i += 1 if i == len(str): break list.append(str[s:i]) if i == len(str): break while str[i] ==" " or str[i] in [".",","]: i += 1 if i == len(str): break
print(len(list[-1]))