Description [title]
Kaikai just wrote a wonderful essay, I wonder how many characters in the title of this essay?
Note: The title may contain upper and lower case letters, numbers, characters, spaces and line breaks. When the title character statistics, spaces and line breaks are not counted.
[Enter]
enter only one line, a string
。
[Output]
output only one line containing an integer that is the number of characters essay title (no spaces and line breaks).
[Input] Sample
234
[output] Sample
3
[Note]
[Sample 1] Description
A total of title characters, which characters are numeric characters.
Sample input [2]
Ca 45
[2] Sample Output
4
[Description] Sample 2
A total of title characters, including uppercase letters, lowercase letters and numeric characters, as well as spaces. Because spaces are not included in the results, so the effective number of characters for the title Ge.
[Agreed] with the scale data
Provision A string representing the length (i.e., the character string and the number of spaces).
For 40% of the data, , to ensure that input for the end of the line numeric characters and line breaks.
For 80% of the data, , the input may only contain upper and lower case letters, numeric characters and the end of the line newline.
To 100% of the data, , the input may contain upper and lower case letters, numbers end characters, spaces, line breaks and line.
#include<bits/stdc++.h>
using namespace std;
long long ans;
string s;
int main(){
getline(cin, s);
int len = s.size();
for(int i=0; i<len; i++){
if(s[i] != ' ')
++ans;
}
printf("%lld", ans);
return 0;
}