/* For a short string, like "abaz" a Hashmap like (a:2, b:1, z:1) will be shorter, than a whole alphabet*/
#include<stdio.h>
#include<conio.h>
main()
{
int count,i,j;
char str[50];
printf("Enter string : ");
gets(str);
for(i=0;i<=strlen(str)-1;i++)
{
count=1;
if(str[i]==' ')
continue;
for(j=i+1;j<=strlen(str)-1;j++)
{
if(str[i]==str[j])
{
str[j]=' ';
count++;
}
}
printf("%c : %d \n",str[i],count);
}
getch();
}
/*Answered by Ankush Monga
Doing DOEACC B level*/
Copyright © 2026 eLLeNow.com All Rights Reserved.