哪位大神帮帮我啊
查看原帖
哪位大神帮帮我啊
663740
qinxili楼主2023/11/4 14:31
#include <bits/stdc++.h>
using namespace std;
int a[26];
string b;
int main()
{
	int n,maxn;
	cin>>b;
	for(int i=0; i<4; i++)
	{
		n=b.size();
		for(int j=0; j<n; j++)
		{
			if(b[j]>='A' && b[j]<='Z')
			{
				a[b[j]-'A']++;
			}
		}
	}
	for(int i=0; i<26; i++)
	{
		maxn=max(maxn,a[i]);
	}
	for(int i=maxn; i>0; i--)
	{
		for(int j=0; j<26; j++)
		{
			if(a[j]>=i)
			{
				cout<<"*";
			}
			else
			{
				cout<<" ";
			}
			cout<<endl;
		}
	}
	for(int i=0; i<26; i++)
	{
		printf("%c",i+'A');
	}
	return 0;
}
2023/11/4 14:31
加载中...