题目传送门
算法解析
本题就是一个语法题,没有什么技术含量。
就直接输入一个字符串,然后数一下不是空格的字符个数,最后输出就可以了。
总代码
#include <iostream>
#include <string>
using namespace std;
string s;
int cnt;
void inp() {
getline(cin, s);
}
void work() {
for(auto ch : s)
cnt += (ch != ' ');
cout << cnt << endl;
}
int main() {
inp();
work();
return 0;
}
提交记录
尾声
如果这篇博客对您(您的团队)有帮助的话,就帮忙点个赞,加个关注!
最后,祝您(您的团队)在 OI 的路上一路顺风!!!
┬┴┬┴┤・ω・)ノ ByeBye