WA求救
查看原帖
WA求救
1047309
return_second楼主2023/10/13 16:24

为啥排版不规范???

#include <iostream>
#include <string>
using namespace std;
int a[27]; 
int main()
{
	string s;
	int maxn=-1e9;
	for(int i=1;i<=4;i++)
	{
		getline(cin,s);
		for(int j=0;j<s.length();j++)
			if(s[j]>='A'&&s[j]<='Z')
				a[s[j]-64]++;
	}
	for(int i=1;i<=26;i++)
		maxn=max(maxn,a[i]);
	for(int i=maxn;i>=1;i--)
	{
		for(int j=1;j<=26;j++)
		{
			if(a[j]>=i)
				printf("*");
			printf(" ");
		}
		printf("\n");	
	}
	printf("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;
}
2023/10/13 16:24
加载中...