#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
static char str[256] = "apple,fruit,orange,help,work.\0";
printf("%s\n",str);
char ch = '\0'; int max_count = 0;
for (int i = 0; str[i] != '\0'; i++)
{
int count = 0;
char* wd = strtok(str, ",");
while (wd != NULL)
{
if (strchr(wd, str[i]) != NULL)
count++;
wd = strtok(NULL, ",");
}
if (count > max_count || max_count == 0)
{ max_count = count; ch = str[i]; }
}
printf("%c --> %d\n",ch,max_count);
return 0;
}