I'm trying to print out the most consecutive pairs. Please Help.Code:for(;concat[a] != '\0';a++){ for(;concat[b] != '\0';b++){ if(concat[a]==concat[b+2] && concat[a+1]==concat[b+3]) { count++; if(count>count2){ count2=count; count=1; printf(" %c%c", concat[b+2], concat[b+3]); printf(" %d",count2); } else if(count==count2){ count=1; printf(" %c%c", concat[b+2], concat[b+3]); printf(" %d",count2); } } } }
Terribly sorry, its just a method from a part of a program. I'll post an example.
Input : This is another test (Another method has been placed to ignore the white space and case).
Output: (nothing happened).
Expected output to print:
th 2
is 2
I'm trying to place a check for the first pair to compare with the next pair and next till the end. It goes on until the first pair reaches the end.



LinkBack URL
About LinkBacks


