> maxRepeat) { /* ... */ } part?
Break; ..0but not sure of your requirements!
use doubly linked list cmp each word with previous ones
i though in one input
#include <stdio.h> #include <string.h> int main(){ char buf[80]={[0]=0}; char word[80]={[0]=0}; char maxw[80]={[0]=0}; size_t count=0; size_t max=0; int ret=scanf("%s",buf); while(ret>0){ while( (ret=scanf("%s",word)) > 0 && !strcmp(buf,word) ) ++count; if( count > max){ max = count; strcpy(maxw,buf); } strcpy(buf,word); count=0; } printf("%s %ld", maxw,max+1); return 0; }
Обсуждают сегодня