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.
31 lines
844 B
31 lines
844 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
int n = 4;
|
|
string s;
|
|
unordered_map<char, int> _map;
|
|
|
|
int main() {
|
|
//读入并记录
|
|
while (n--) {
|
|
getline(cin, s);
|
|
for (int i = 0; i < s.size(); i++)
|
|
if (s[i] >= 'A' && s[i] <= 'Z') _map[s[i]]++;
|
|
}
|
|
//1、找出最大值,这个最大值就是行数
|
|
int Max = -1;
|
|
for (auto it = _map.begin(); it != _map.end(); it++)
|
|
Max = max(Max, it->second); //Hash表的遍历
|
|
//2、从大到小
|
|
for (int i = Max; i >= 1; i--) {
|
|
//每一列噢.对应着字母A-Z
|
|
for (int j = 0; j < 26; j++)
|
|
if (_map['A' + j] >= i) cout << "* ";
|
|
else cout << " ";
|
|
cout << endl;
|
|
}
|
|
//3、补一下大写字母
|
|
for(int i=0;i<26;i++)cout<<char(i+'A')<<" ";
|
|
return 0;
|
|
}
|