Advertisement
CR7CR7

title

May 25th, 2022
1,224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let arr = gets().split('');
  2. let num = Number(gets());
  3.  
  4.  
  5. for (let i = 0; i < num; i++) {
  6.     let arrMatch = gets().split('');
  7.     let arrTemp = [...arr];
  8.     let limiter = 0;
  9.  
  10.     for (let k = 0; k < arrMatch.length; k++) {
  11.         if (arrTemp.indexOf(arrMatch[k]) > -1) {
  12.             arrTemp[(arrTemp.slice(limiter).indexOf(arrMatch[k]) + limiter)] = ' ';
  13.             limiter = arrTemp.lastIndexOf(' ');
  14.         }
  15.     }
  16.    
  17.     arrTemp = arrTemp.join('').split(' ').join('');
  18.  
  19.     if (arrTemp.length === arr.length - arrMatch.length) {
  20.         arr = arrTemp.split('')
  21.         print(arrTemp);
  22.     } else {
  23.         print('No such title found!')
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement