http://118.190.20.162/view.page?gpid=T14
#include<bits/stdc++.h>
#include<string>
using namespace std;
string standard,input,temp,temp2;
void func(string standard,string input,int op){
if(op==1){
if(input.find(standard)!=-1)
cout<<input<<endl;
return ;
}
else{
temp=input;
for(int i=0;i<temp.length();i++){
if(temp[i]>='a'&&temp[i]<='z'){
temp[i]=temp[i]-'a'+'A';
}
}
temp2=standard;
for(int i=0;i<temp2.length();i++){
if(temp2[i]>='a'&&temp2[i]<='z'){
temp2[i]=temp2[i]-'a'+'A';
}
}
if(temp.find(temp2)!=-1){
cout<<input<<endl;
return;
}
}
}
int main(){
cin>>standard;
int n,op;
cin>>op>>n;
for(int i=0;i<n;i++){
cin>>input;
func(standard,input,op);
}
return 0;
}