大佬们帮忙看看,为什么1,3,4会wa
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a[130] = {0};
for (int i = 0; i < 4; i++)
{
char tmp[100];
fgets(tmp,101,stdin);
int len = strlen(tmp);
for (int j = 0; j < len; j++)
a[(int)tmp[j]]++;
}
string b;
int flag = 0;
int max = -1;
for (int i = 65; i <= 90; i++)
{
if (a[i])
{
if (flag)
b = b + ' ';
b = b + (char)i;
flag = 1;
}
if (max < a[i])
max = a[i];
}
for (int j = max; j > 0; j--)
{
flag = 0;
for (int i = 65; i <= 90; i++)
{
if (a[i])
{
if (flag)
cout << " ";
if (a[i] >= j)
cout << "*";
else
cout << " ";
flag = 1;
}
}
cout << endl;
}
cout << b;
}