Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_replaceable(s, t):
- if len(s) < len(t):
- return 'UNRESTORABLE'
- for i in range(len(s) - len(t) + 1):
- replaceable = True
- for x,y in zip(s[i:], t):
- if x != y and x != '?':
- replaceable = False
- if replaceable:
- s = s[:i] + t + s[i + len(t):]
- return s.replace('?', 'a')
- return 'UNRESTORABLE'
- s, t = input(), input()
- print(is_replaceable(s, t))
Add Comment
Please, Sign In to add comment