1 solutions
-
0
C++ :
#include<iostream> #include<string> #include<cctype> using namespace std; int Let=0,Dig=0,Spa=0,Oth=0; void solve(string s) { int len=s.size(); for (int i=0; i<len; i++) if (isalpha(s[i])) Let++; else if (isdigit(s[i])) Dig++; else if (s[i]==' ') Spa++; else Oth++; } int main() { string s; getline(cin,s); solve(s); cout<<Let<<" "<<Dig<<" "<<Spa<<" "<<Oth<<" "<<endl; return 0; }
- 1
Information
- ID
- 19111
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- (None)
- # Submissions
- 0
- Accepted
- 0
- Uploaded By