//#include
#include
//#include
int main(){
char arr[1001];
map<char,int> Nmap;
fgets(arr,1001,stdin);
string str = arr;
str.pop_back();
for(int i =0 ;i<str.size();i++){
if(Nmap.find(str[i]) != Nmap.end()){
Nmap[str[i]] ++;
} else{
Nmap[str[i]] = 1;
}
}
map<char,int> :: iterator it;
for(it = Nmap.begin();it != Nmap.end();it++){
printf("%c:%d",it->first,it->second);
printf("\n");
}
return 0;
}
数据的输入呢,是不是如果输入过大会溢出了。
不知道你这个问题是否已经解决, 如果还没有解决的话: