#include <stdio.h>
#include <ctype.h>
#include <string.h>

int more_freq(char *str)
{
	int i,j,k,n,max=0,tmp=0;

 n=strlen(str);
 for (i=0;i<n;i++)
 {
     tmp=1;
     for (j=i+1;j<n;j++)
         {
         if (toupper(str[i])!=toupper(str[j]))
           continue;
         else tmp++;
         }
     if (tmp>max) {
                  max=tmp;
                  printf("il char '%c' appare %d volte\n",str[i],tmp);
                  }
 }
return max;
}



int main(void)
{

	char str[21], tmp[21], ch;
	int res;

	printf("Inserisci una stringa.\n");
	scanf("%20[A-Za-z0-9',! ]", str);
	printf("Ho letto %s\n", str);
	res=more_freq(str);
    printf("il char piu' frequente in '%s' appare %d volte\n",str,res);
    scanf("%s", &ch);
	return(0);
}

