题解 | #字符串最后一个单词的长度#
字符串最后一个单词的长度
http://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da
var str = readline().trim(); // readline() , 从控制台读取数据
var length = str.length;
var ch, index = 0;
while(index < length) {
ch = str[length - (index + 1)];
if (ch === ' ') {
break;
}
index++;
}
console.log(index)