4 条题解
-
0
#include<stdio.h>
#include<string.h>
int main()
{
int t;
scanf("%d",&t);
while (t--)
{
char s[1011];
scanf("%s", s);
int len = strlen(s);
int a[26] = { 0 };
char b[27] = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < len; i++)
{
for (int j = 0; j < 26; j++)
{
if (s[i] == b[j])
{
a[j]++;
}
}
}
int max = a[0];
int m = 0;
for (int i = 1; i < 26; i++)
{
if (max < a[i])
{
max = a[i];
m= i;
}
}
printf("%c\n", b[m]);
}
return 0;
}
信息
- ID
- 186
- 时间
- 3000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- (无)
- 递交数
- 485
- 已通过
- 218
- 上传者