codechef NOLOGIC - "lack of logic" editorial : http://discuss.codechef.com/questions/6642/nologic-editorial
codechef NOLOGIC - "lack of logic" solution : http://ideone.com/qPhKVq
#include <iostream>#include <stdio.h>
#include <cstring>
using namespace std;
int main() {
int t, flag;
scanf("%d", &t);
char c;
scanf("%c", &c);
while(t--) {
char s[500];
flag=0;
int a[130];
memset(a, 0, sizeof(a));
gets(s);
for(int i=0; i<strlen(s); i++) a[s[i]]++;
for(int i=65; i<91; i++) {
if(a[i]==0 && a[i+32]==0) {
flag=1;
printf("%c\n", i);
break;
}
}
if(flag==0) printf("~\n");
}
return 0;
}
note: use <stdio.h> instead of <cstdio> when using gets(), because gets() dont work well with <cstdio>.
also read the character(scanf("%c", &c);) after digit t.
No comments:
Post a Comment