大佬们救救孩子吧!全WA
查看原帖
大佬们救救孩子吧!全WA
527243
Iamzzr楼主2021/9/30 22:08
#include <bits/stdc++.h>
using namespace std;
const int M=10005;
string s[5];
int c[105];
int main(){
	for(int i=1; i<=4; i++)
		getline(cin, s[i]);
	for(int i=1; i<=4; i++){
		for(int j=1; j<=s[i].size(); j++)
			c[s[i][j]]++;
	}
	int maxx=-1;
	for(int i=65; i<=90; i++)
		maxx=max(maxx, c[i]);
	for(int i=maxx; i>=0; i--){
		if(i){
			int n;
			for(int j=65; j<=90; j++)
				if(c[j]>=i) n=j;
				
			for(int j=65; j<=90; j++){
				if(c[j]>=i) cout<<"*";
				else cout<<" ";
				if(j==n) break;
					
				if(j!=90) cout<<" "; 
			}
				
			cout<<endl;
		}
		else{
			for(int j=65; j<=90; j++){
				cout<<(char)j;
				if(j!=90) cout<<" ";
			}
		}
	}
	return 0;
}
2021/9/30 22:08
加载中...