慕容5123895
#include<iostream>#include<string>using namespace std;int main(){ cout << "请输入字符串:" << endl; string s; getline(cin, s); int count = s.size(); char letter[26] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' }; for (int i = 0; i < 26; i++) { int num = 0; for (int j = 0; j < count; j++) { if (s[j] == letter[i]) { num++; } } if (num > 0) { cout << letter[i] << ":" << num << endl; } num = 0; } system("pause"); return 0;}