#include <iostream> #include <string> using namespace std; int main() { string str; getline(cin, str); int whitespace = 0; int digits = 0; int chars = 0; int others = 0; // write your code here...... for (auto& x: str) { if (isalpha(x)) { chars++; } else if (isspace(x)) { whitespace++; } else if (isdigit(x)) { digits++; } else if (ispunct(x)) { others++; } else { others++; } } cout << "chars : " << chars << " whitespace : " << whitespace << " digits : " << digits << " others : " << others << endl; return 0; }