Guest User

Untitled

a guest
Mar 26th, 2023
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. title = list(input())
  2. n = int(input())
  3.  
  4. for _ in range(n):
  5.     word = input()
  6.     current_title = title.copy()
  7.     word_found = True
  8.     for letter in word:
  9.         if letter in current_title:
  10.             current_title.remove(letter)
  11.         else:
  12.             word_found = False
  13.             break
  14.  
  15.     if word_found:
  16.         print(''.join(current_title))
  17.         title = current_title
  18.     else:
  19.         print("No such title found!")
Advertisement
Add Comment
Please, Sign In to add comment