华为机试在线训练–牛客网(python)

华为机试在线训练–牛客网(python) 第一部分(1~10) 第一题:求字符串最后一个单词的长度 #coding=utf-8 str = raw_input("") space_sky = ' ' if space_sky in str: str_sp = str.split(' ') print len(str_sp[-1]) else: print len(str)
相关文章
相关标签/搜索