求助!!!为什么80分
查看原帖
求助!!!为什么80分
343245
Bigfish_楼主2021/2/1 21:20
#include <bits/stdc++.h>
using namespace std;
int k[30]={},maxn=0; //26
int main()
{
	string a;
	for(int t=1;t<=4;++t)
	{
		getline(cin,a);	
		for(int i=0;i<a.size();++i)
		{
			if(a[i]>='A'&&a[i]<='Z') ++k[a[i]-64];
		}
	} 
	for(int t=1;t<=26;++t)
		if(maxn<k[t]) maxn=k[t];
	for(int t=maxn;t>=1;--t)
	{
		for(int i=1;i<=26;++i)
		{
			if(k[i]>=t)	cout<<"*";
			else cout<<" ";
			if(t!=26) cout<<" ";	
		}
		cout<<"\n";
	} 
	cout<<"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
	return 0; 
}
2021/2/1 21:20
加载中...