Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - let input = [
 - 'tepeplpepreik',
 - '3',
 - 'telerik ',
 - 'gagaga',
 - 'gp'
 - ];
 - let print = this.print || console.log;
 - let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
 - // let str = '1234567';
 - // let index = 3;
 - //str = str.substring(0, index) + str.substring(index + 1);
 - let word= gets().split('')
 - let n = +gets()
 - let l = word.length
 - let newWord=[];
 - isTitle=false;
 - for (let i = 0; i < n; i++) {
 - let sub = gets().split('')
 - for (let j = 0; j < l; j++) {
 - let first = word.shift();
 - newWord.push(first);
 - for(let d = 0; d < sub.length; d++){
 - let start = sub[d]
 - if(start===first){
 - sub.shift();
 - newWord.pop();
 - isTitle=true;
 - break;
 - }else{
 - isTitle=false;
 - }
 - }
 - }
 - word=newWord
 - if(isTitle){
 - print(word.join(""));
 - }else{
 - print("No such title found!");
 - }
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment