Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //URI Problem 1255(Level Two)
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- int a,b,c,d,e=0,f,g,h,i,z,m;
- char j,x[200],w[200],y[200],zz[]={"abcdefghijklmnopqrstuvwxyz"};
- scanf("%d",&f);
- getchar();
- for(a=0; a<f; a++)
- {
- gets(x);
- e=strlen(x);
- g=0;
- h=0;
- z=2;
- i=0,m=0;
- for(b=0; b<26; b++)
- {
- for(c=0; c<e; c++)
- {
- if(x[c] >= 65 && x[c] <= 90){x[c] += 32;}
- if(x[c]==zz[b])
- {
- g++;
- }
- }
- if(g==1)
- {
- w[h]=zz[b];
- h++;
- }
- if(g>z)
- {
- z=g;
- j=zz[b]; //cant build the logic..how I can print this...??
- }
- if(g==z)
- {
- //m++;
- if(i==0||zz[b]!=y[i]) //cant build the logic..how can I print this...??
- y[i]=zz[b];
- i++;
- }
- g=0;//puts(y);
- }
- w[h]='\0';
- y[i]='\0';
- if(z==2)
- {
- puts(w);
- }
- else if(m<z)
- {
- printf("%c\n",j);
- }
- else
- {
- puts(y);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement