#include<stdio.h> #include<string.h> int main() { char str[1000];/*保存读取到的字符串*/ int a; while(scanf("%s",&str)!=EOF);/*输入的字符串不为空*/ a=strlen(str);/*strlen是用于计算字符串长度的函数*/ printf("%d",a); return 0; }