Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<ctype.h>
- int main(){
- char s[500],*p[500],*q;
- int a[100],n=0;
- gets(s);
- strlwr(s);
- for(p[n]=strtok(s," ");p[n]!=NULL;p[++n]=strtok(NULL," "));
- int max=1;
- for(int i=0;i<n;i++){
- a[i]=1;
- }
- for(int i=0;i<n;i++){
- int count=1;
- if(a[i]){
- a[i]=0;
- for(int j=i+1;j<n;j++){
- if(strcmp(p[i],p[j])==0){
- count++;
- }
- }
- if(count>max) {
- max=count;
- q=p[i];
- }
- }
- }
- printf("%s %d",q,max);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement