#include <iostream> #include <cstdio> #include <string> #include <algorithm> using namespace std; const int MAX_NUM = 26; /** * 字母统计--上海交通大学 * @return */ int main() { string str; while (getline(cin, str)) { int count[26] = {0}; /* * 统计str字符串中每个字符出现的次数 * 以(字符 - 'A')的ASCII为count[]数组的索引 */ for (int i = 0; i < str.size(); ++i) { if ('A' <= str[i] && str[i] <= 'Z') { count[str[i] - 'A']++; } } for (int j = 0; j < MAX_NUM; ++j) { cout << char('A' + j) << ":" << count[j] << endl; } } return 0; }