有问题吗???
查看原帖
有问题吗???
663740
qinxili楼主2023/11/5 12:35

#include<bits/stdc++.h>
using namespace std;
int a[26];
int main()
{
	int n,maxn;
	char b[85];
	for(int i=0; i<4; i++)
	{
		gets(b);
		n=strlen(b);
		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/5 12:35
加载中...