不知道发生了什么的蒟蒻,代码主要是自己写的,参考了点书。
#include<bits/stdc++.h>
using namespace std;
int hash[101],maxss;string s;
void outend(){
for (int i='A';i<='Z';++i){
cout<<char(i)<<' ';
}
return ;
}
int findmax(){
int maxs=0;
for (int i=0;i<26;++i){
maxs=max(maxs,hash[i]);
}
return maxs;
}
int main(){
for (int i=0;i<4;++i){
getline(cin,s);
for (int i=0;i<s.size();++i){
if (s[i]<'A' || s[i]>'Z')continue;
hash[s[i]-'A']+=1;
}
}
maxss=findmax();
for (int i=maxss;i>=1;--i){
for (int j=0;j<=25;++j){
if (hash[j]>=i)cout<<"* ";else cout<<" ";
}
cout<<endl;
}
outend();
return 0;
}