题解 | #字母统计#
字母统计
https://www.nowcoder.com/practice/de7bf0945c1c4bd1aa9d49573b831f3c
#include "bits/stdc++.h" using namespace std; int main() { string str; int number[26]; while (cin>>str) { memset(number,0,sizeof(number)); for (int i = 0; i < str.size(); ++i) { if ('A'<=str[i]&&str[i]<='Z') { number[str[i]-'A']++; } } for (int i = 0; i < 26; ++i) { printf("%c:%d\n",'A'+i,number[i]); } } }