Guest User

Untitled

a guest
Mar 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. def is_replaceable(s, t):
  2. if len(s) < len(t):
  3. return 'UNRESTORABLE'
  4.  
  5. for i in range(len(s) - len(t) + 1):
  6.  
  7. replaceable = True
  8. for x,y in zip(s[i:], t):
  9. if x != y and x != '?':
  10. replaceable = False
  11.  
  12. if replaceable:
  13. s = s[:i] + t + s[i + len(t):]
  14. return s.replace('?', 'a')
  15.  
  16. return 'UNRESTORABLE'
  17.  
  18.  
  19. s, t = input(), input()
  20. print(is_replaceable(s, t))
Add Comment
Please, Sign In to add comment