counting char size
0
September 27, 2022
#include
#include
int main()
{
char string[] = "VARDHAN RAJU";
int i, j, length = strlen(string);
int freq[length];
for(i = 0; i < strlen(string); i++) {
freq[i] = 1;
for(j = i+1; j < strlen(string); j++)
{
if(string[i] == string[j])
{
freq[i]++;
string[j] = '0';
}
}
}
printf("Charactersfrequencies\n");
for(i = 0; i < length; i++) {
if(string[i] != ' ' && string[i] != '0')
printf("%c-%d\n", string[i], freq[i]);
}
return 0;
}