You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
837 B
34 lines
837 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
int n = 4;
|
|
string s;
|
|
const int N = 110;
|
|
int a[N];
|
|
|
|
int main() {
|
|
//读入并记录
|
|
while (n--) {
|
|
getline(cin, s);
|
|
for (int i = 0; i < s.size(); i++)
|
|
if (s[i] >= 'A' && s[i] <= 'Z') a[s[i] - 'A']++;
|
|
}
|
|
//1、找出最大值,这个最大值就是行数
|
|
int Max = -1;
|
|
for (int i = 0; i < 26; i++)Max = max(Max, a[i]);
|
|
|
|
//2、从大到小
|
|
for (int i = Max; i >= 1; i--) {
|
|
//每一列噢.对应着字母A-Z
|
|
for (int j = 0; j < 26; j++)
|
|
if (a[j] >= i) cout << "* ";
|
|
else cout << " ";
|
|
cout << endl;
|
|
}
|
|
//3、补一下大写字母
|
|
for (int i = 0; i < 26; i++) {
|
|
cout << char(i + 'A');
|
|
if (i < 25) cout << " ";
|
|
}
|
|
return 0;
|
|
} |