NOLOGIC - Editorial

hm, now I realized, that %d%*c is probably a typo, @anton_lunyov, can you please confirm that?

Why do you think so?
scanf("%d%*c",&T) will exactly input T and skip the next character after T.

silly mistake there @amitupadhyay in the for loop, @anton_lunyov pointed it right. Really, one ignore these things in a tight time bound competition.

Simply I didn’t know about * sub-specifier, thanks for clarification :wink:

CodeChef: Practical coding for everyone see this i just changed your code

scanf("%d",&t);//instead of scanf("%d\n",&t);
gets(s);//to read the new line

and i got an AC

space is not a letter. If question contains all possible letters but does not contain spaces you still need to output ~

so does it mean that a question containing spaces can have an answer with spaces in it?

i used the below code don’t know why it is showing error:

#include <bits/stdc++.h>
using namespace std;

string process(string s){
bool arr[26]={false};
for(int i=0;i<s.length();++i){
if(s[i]>=β€˜a’ && s[i]<=β€˜z’) arr[s[i]-β€˜a’]=true;
if(s[i]>=β€˜A’ && s[i]<=β€˜Z’) arr[s[i]-β€˜A’]=true;
}
string out="";
for(int i=0;i<26;i++){
if(arr[i]==false) out+=(i+β€˜a’);
}
if(out.length()==0) return β€œ~”;
return out;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
string s;
cin>>t;
while(t–){
cin>>s;
cout<<process(s)<<endl;
}
return 0;
}