#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
string s;
int temp;
while(getline(cin, s)){
int count[30] = {0};
for(int i = 0; i < s.length(); i++){
temp = s[i] - 97;
if(temp >= 0 && temp <= 26){
count[temp]++;
}
}
char ch;
for(int i = 0; i < 26; i++){
ch = (char)('a' + i);
cout<<ch<<":"<<count[i]<<endl;
}
cout<<endl;
}
}hdoj1219简单题、模拟题
最新推荐文章于 2017-12-20 14:18:55 发布
本文介绍了一个简单的C++程序,该程序能够读取标准输入的字符串并统计其中每个小写字母出现的次数。通过使用字符数组来计数,程序最终会输出每个字母及其对应的出现次数。
1879

被折叠的 条评论
为什么被折叠?



