#include<stdio.h>
#include<string.h>
int main()
{
int i, j, k = 0, count = 0, max = 0, a[100], len;
char ch[100], b[100];
scanf("%s", &ch);
len = strlen(ch);
for(i='a';i<='z';i++)
{
count = 0;
for(j=0;j<len;j++)
{
if(ch[j] == i)
{
count++;
}
}
b[k] = i;
a[k] = count;
k++;
if(max < count)
{
max = count;
}
}
for(i=0;i<k;i++)
{
if(max == a[i])
{
printf("%c = %d\n", b[i],a[i]);
}
}
return 0;
}
#include<string.h>
int main()
{
int i, j, k = 0, count = 0, max = 0, a[100], len;
char ch[100], b[100];
scanf("%s", &ch);
len = strlen(ch);
for(i='a';i<='z';i++)
{
count = 0;
for(j=0;j<len;j++)
{
if(ch[j] == i)
{
count++;
}
}
b[k] = i;
a[k] = count;
k++;
if(max < count)
{
max = count;
}
}
for(i=0;i<k;i++)
{
if(max == a[i])
{
printf("%c = %d\n", b[i],a[i]);
}
}
return 0;
}
Comments
Post a Comment