给定一行长度不超过 100 的非空字符串,请你求出它的具体长度。
输入格式
输入一行,表示一个字符串。注意字符串中可能包含空格。
输出格式
输出一个整数,表示它的长度。
输入样例:
I love Beijing.
输出样例:
15
题目很简单,代码如下:
#include#include #include using namespace std; int main() { int i,count; count = 0; string s; //fgets(s,100,stdin);//fgets()用于字符数组的输入,不能输入字符串 getline(cin,s); for(i = 0;s[i]&& s[i] != 'n';i++) count += 1; cout<



