80分求助!#5WA
查看原帖
80分求助!#5WA
319478
zhibuba楼主2020/5/4 23:19
#include <stdio.h>
#include <ctype.h>

int main(void)
{
	int times[26] = {0};
	int i = 0;
	char c;
	while (i < 4)
	{
		c = getchar();
		if (isupper(c))
			times[c - 'A']++;
		else if (c == '\n' || c == EOF)
			i++;
	}
	int max = 0;
	for (int i = 0; i < 26; i++)
	{
		if (times[i] > max)
			max = times[i];
	}
	for (int i = 0; i < max; i++)
	{
		for (int j = 0; j < 26; j++)
		{
			if (max - i <= times[j] )
				putchar('*');
			else
				putchar(' ');
			if (i < 25)
				putchar(' ');
		}
		putchar('\n');
	}
	for (int j = 0; j < 26; j++)
	{
		putchar('A' + j);
		if (j < 25)
			putchar(' ');
	}
	return 0;
}
2020/5/4 23:19
加载中...