#include<stdio.h>
#include<string.h>
int main()
{
char str[10000],m,n,c,x,ch;
int i,len,j,k,l1,temp,l2,i4,large,j4,df,z,test,t1;
while(gets(str)!=NULL)
{
len=strlen(str);
int val[200]={0};
for(j=0;j<len;j++)
{ x=str[j];
if((x>='a')&&(x<='z'))
{
for(k=0;k<len;k++)
{
if(x==str[k])
{
val[x]=val[x]+1;
str[k]='0';
}
}
}
else if ((x>='A')&&(x<='Z'))
{
for(k=0;k<len;k++)
{
if(x==str[k])
{
val[x]=val[x]+1;
str[k]='0';
}
}
}
}
for(z=91;z<=96;z++)
val[z]=0;
large=-1;
for(i4=65;i4<=122;i4++)
if((val[i4]>large)&&(val[i4]!=0))
large=val[i4];
for(j4=65;j4<=122;j4++)
{ if((val[j4]==large)&&(val[j4]!=0))
printf("%c",j4);
}
printf(" %d",large);
printf("\n");
}
return 0;
}
#include<string.h>
int main()
{
char str[10000],m,n,c,x,ch;
int i,len,j,k,l1,temp,l2,i4,large,j4,df,z,test,t1;
while(gets(str)!=NULL)
{
len=strlen(str);
int val[200]={0};
for(j=0;j<len;j++)
{ x=str[j];
if((x>='a')&&(x<='z'))
{
for(k=0;k<len;k++)
{
if(x==str[k])
{
val[x]=val[x]+1;
str[k]='0';
}
}
}
else if ((x>='A')&&(x<='Z'))
{
for(k=0;k<len;k++)
{
if(x==str[k])
{
val[x]=val[x]+1;
str[k]='0';
}
}
}
}
for(z=91;z<=96;z++)
val[z]=0;
large=-1;
for(i4=65;i4<=122;i4++)
if((val[i4]>large)&&(val[i4]!=0))
large=val[i4];
for(j4=65;j4<=122;j4++)
{ if((val[j4]==large)&&(val[j4]!=0))
printf("%c",j4);
}
printf(" %d",large);
printf("\n");
}
return 0;
}
No comments:
Post a Comment