提交时间:2024-08-19 18:31:16
运行 ID: 50329
#include<bits/stdc++.h> using namespace std; string s[4]; int words[26]; int main(){ for(int i=0;i<4;i++){ getline(cin,s[i]); } for(int i=0;i<4;i++){ for(int j=0;j<s[i].size();j++){ if(s[i][j]>='A'&&s[i][j]<='Z') words[s[i][j]-'A']++; } } int max=0; for(int i=0;i<26;i++){ if(words[i]>max){ max=words[i]; } } for(int i=0;i<max;i++){ for(int j=0;j<26;j++){ if(words[j]>=(max-i)){ cout<<"* "; }else cout<<" "; } cout<<endl; } for(char l='A';l<='Z';l++){ cout<<l<<" "; } return 0; }