字符串最后一个单词的长度
字符串最后一个单词的长度
http://www.nowcoder.com/questionTerminal/8c949ea5f36f422594b306a2300315da
include<stdio.h>
include<stdlib.h>
int main()
{
char str[5000] = { 0 };
gets(str);
char* forword = str;
char* back = str;
while (forword != '\0')
{
if (forword == ' ')
back = forword+1;
forword++;
}
printf("%d\n", forword - back); return 0;
}