解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<string.h>
int main()
{
char str[1001];
gets(str);
str[strlen(str)] = '\0';
int i=0,j, length_character=0;
while (str[i] != '\0')
{
while (str[i] != ' '&&str[i]!='\0')
{
length_character++;
i++;
}
if (str[i] != '\0' && i != strlen(str)-1&&length_character!=0)
{
printf("%d,", length_character);
}
else if(length_character!=0)
printf("%d", length_character);
if (str[i] == ' ')
{
length_character = 0;
i++;
}
}
return 0;
}
0.0分
0 人评分