#include <stdio.h>
#include <string.h>
int count [26];
int main ()
{
char a[100];
int i,j;
printf("Enter string: ");
gets(a);
for(i=0;i<a[i];i++)
{
if(a[i]>='A'&&a[i]<='Z')
{
a[i]=a[i]-'A'+'a';
count [a[i]-'a']++;
}
else if(a[i]>='a'&&a[i]<='z')
count[a[i]-'a']++;
}
for(i=0;i<a[i];i++)
{
if(count[i]>0)
printf("%c = %d\n",(i+'a'),count[i]);
}
return 0;
}
No comments:
Post a Comment