#include <iostream> #include <cstring> using namespace std; #include<map> int main() { map<string,int> x; x["letter"]=0; x["digit"]=0; x["space"]=0; x["other"]=0; char buf[1024] = {0}; cin.getline(buf, sizeof(buf)); // write your code here...... for(int i=0;i<sizeof(buf);i++) { if(buf[i]!=0) { if(isalpha(buf[i])) x["letter"]++; else if (buf[i]==' ') x["space"]++; else if(isdigit(buf[i])) x["digit"]++; else x["other"]++; } } cout << "letter:" << x["letter"] << " digit:" << x["digit"] << " space:" << x["space"] << " other:" << x["other"] << endl; return 0; }