bounslay

Untitled

May 21st, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. title = input()
  2. n = int(input())
  3.  
  4.  
  5. for i in range(n):
  6.     new_title = ''
  7.     sub_title = input()
  8.     #print(sub_title)
  9.  
  10.     for ch in title:
  11.         if sub_title != '' and ch != sub_title[0]:
  12.             new_title += ch
  13.            
  14.         else:
  15.            
  16.             new_title += '_'
  17.             sub_title = sub_title[1:]
  18.        
  19.  
  20.         if sub_title == '' and i == 0:
  21.             indices = title.index(ch)
  22.             new_title += title[indices+1:]
  23.        
  24.            
  25.             our_string = ''
  26.             for ch in new_title:
  27.                 if ch != '_':
  28.                     our_string += ch
  29.                    
  30.        
  31.             new_title = our_string
  32.             title = new_title
  33.             print(title)
  34.             break
  35.  
  36.         elif sub_title == '' and i > 0:
  37.            
  38.             our_string = ''
  39.             for ch in new_title:
  40.                 if ch != '_':
  41.                     our_string += ch
  42.                    
  43.        
  44.             new_title = our_string
  45.             title = new_title
  46.             print(title)
  47.             break
  48.        
  49.  
  50. if title != '' and title[0] == new_title[0]:
  51.     print('No such title found!')
Advertisement
Add Comment
Please, Sign In to add comment