求调!!!
查看原帖
求调!!!
1148832
LabmemNo_012LzTopic楼主2024/7/19 12:04
#include <iostream>
#include <cstring>
#include <stdio.h>
#include<map>

using namespace std;

int main()
{
	char str[30] = { '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' };
	map<char, int> hash;
	char s[105];
	int max = 0;
	for (int i = 1; i <= 4; i++)
	{
		gets(s);
		int k = strlen(s);
		for (int i = 0; i < k; i++)
		{
			hash[s[i]]++;
			if (hash[s[i]] > max)max = hash[s[i]];
		}
	}
	for (int i = max; i >= 1; i--)
	{
		for (int j = 0; j < 26; j++)
		{
			if (hash[str[j]] >= i)printf("*");
			else printf(" ");
		}
		printf("\n");
	}
	for (int i = 0; i < 26; i++)
	{
		printf("%c", str[i]);
	}
	return 0;
}
2024/7/19 12:04
加载中...