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
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;
}