文章
55
粉丝
100
获赞
12
访问
31.1k
#include<stdio.h>
#include<string>
#include<iostream>
#include<map>
using namespace std;
int main(){
string str;
cin>>str;
map<char,int> Mymap;
int len = str.length();
for(int i = 0; i<26; i++){
Mymap[i+65] = 0;
}
for(int i = 0; i<len; i++){
if(str[i]>='A'&&str[i]<='Z'){
if(Mymap.count(str[i]) == 0){
Mymap[str[i]] = 1;
}else{
Mymap[str[i]]++;
}
}
}
for(auto it = Mymap.begin(); it != Mymap.end(); it++){
cout<<it->first<<":"<<it->second<<endl;
}
}
登录后发布评论
暂无评论,来抢沙发