#include <bits/stdc++.h>
using namespace std;
struct trie{
    bool c_word=0;
trie *symbol[26];
trie(){
for(int i=0;i<26;i++){
    symbol[i]=nullptr;
}

}

};
trie *root=new trie();
int i=0;
string s;

void prefix_tree(string c){

trie *cur;

cur=root;
for(int j=0;j<c.size();j++){

    if(cur->symbol[c[j]-'a']==nullptr){

        cur->symbol[c[j]-'a']=new trie();
    }

    cur=cur->symbol[c[j]-'a'];

}


cur->c_word=1;

}
void cenz(){
   trie *cur;
   int p=i;
   cur=root;

while(true){
    if(cur->symbol[s[p]-'a']==nullptr and cur->c_word==1){
       i=p-1;
       return;
    }
    if((cur->symbol[s[p]-'a']==nullptr or p==s.size()) and cur->c_word==0 ){
        return;
    }
    cur=cur->symbol[s[p]-'a'];
    p++;

}



}


int main(){
string c;
int n;

cin>>s;
cin>>n;
while(n>0){
    cin>>c;
    prefix_tree(c);

    n--;
}
while(i<s.size()){
    n=i;
    cenz();
    if(n==i){
        cout<<s[n];
    }
    i++;
}

return 0;
}
