#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char s;
int n=0;
while((s=getchar())!= EOF)//判空
{
if(s != ' '&&s != '\n')//不计空格和换行计算字符个数
n++;
}
cout << n << endl;
return 0;
}
字符串算法学习1getchar判断字符串输入
最新推荐文章于 2024-05-22 18:50:06 发布