Buggy python submission (verdict: Runtime Error):
S_dash = list(map(str, input()))
T = list(map(str, input()))


for i in reversed(range(len(S_dash) - len(T) + 1)):
	flg = 1
	for j in range(len(T)):
		if S_dash[i + j] != "?" and S_dash[i + j] != T[j]:
			flg = 0
			break
	if flg:
		for j in range(len(T)):
			S_dash[i + j] = T[j]
		break
		
if flg:
	for i in range(len(S_dash)):
		pass
		# if S_dash[i] == "?":
			# print("a", end = "")
		# else:
			# print(S_dash[i], end = "")
else:
	print("UNRESTORABLE")


Fixed submission:
S_prime = list(map(str, input()))
T = list(map(str, input()))

len_S = len(S_prime)
len_T = len(T)

un = 1

for i in reversed(range(0, len_S - len_T + 1)):
	match = 1
	for j in range(i, i + len_T):
		# print(S_prime[j], T[j - i])
		if S_prime[j] == "?": continue
		if not S_prime[j] == T[j - i]:
			match = 0
			break
	if match:
		un = 0
		# print(i)
		init = i
		break
		
if un:
	print("UNRESTORABLE")
else:
	for i in range(init, init + len_T):
		S_prime[i] = T[i - init]
	
	for i in range(len_S):
		if S_prime[i] == "?":
			print("a", end = "")
		else:
			print(S_prime[i], end = "")

Buggy python submission (verdict: Runtime Error):
S_dash = list(map(str, input()))
T = list(map(str, input()))


for i in reversed(range(len(S_dash) - len(T) + 1)):
	flg = 1
	for j in range(len(T)):
		if S_dash[i + j] != "?" and S_dash[i + j] != T[j]:
			flg = 0
			break
	if flg:
		for j in range(len(T)):
			S_dash[i + j] = T[j]
		break
		
if flg:
	for i in range(len(S_dash)):
		# if S_dash[i] == "?":
			# print("a", end = "")
		# else:
			# print(S_dash[i], end = "")
else:
	print("UNRESTORABLE")


Fixed submission:
S_prime = list(map(str, input()))
T = list(map(str, input()))

len_S = len(S_prime)
len_T = len(T)

un = 1

for i in reversed(range(0, len_S - len_T + 1)):
	match = 1
	for j in range(i, i + len_T):
		# print(S_prime[j], T[j - i])
		if S_prime[j] == "?": continue
		if not S_prime[j] == T[j - i]:
			match = 0
			break
	if match:
		un = 0
		# print(i)
		init = i
		break
		
if un:
	print("UNRESTORABLE")
else:
	for i in range(init, init + len_T):
		S_prime[i] = T[i - init]
	
	for i in range(len_S):
		if S_prime[i] == "?":
			print("a", end = "")
		else:
			print(S_prime[i], end = "")

Buggy python submission (verdict: Runtime Error):
S_dash = list(map(str, input()))
T = list(map(str, input()))


for i in reversed(range(len(S_dash) - len(T) + 1)):
	flg = 1
	for j in range(len(T)):
		if S_dash[i + j] != "?" and S_dash[i + j] != T[j]:
			flg = 0
			break
	if flg:
		for j in range(len(T)):
			S_dash[i + j] = T[j]
		break
		
if flg:
	for i in range(len(S_dash)):
		if S_dash[i] == "?":
			print("a", end = "")
		else:
			print(S_dash[i], end = "")
else:
	print("UNRESTORABLE")

Fixed submission:
S_prime = list(map(str, input()))
T = list(map(str, input()))

len_S = len(S_prime)
len_T = len(T)

un = 1

for i in reversed(range(0, len_S - len_T + 1)):
	match = 1
	for j in range(i, i + len_T):
		# print(S_prime[j], T[j - i])
		if S_prime[j] == "?": continue
		if not S_prime[j] == T[j - i]:
			match = 0
			break
	if match:
		un = 0
		# print(i)
		init = i
		break
		
if un:
	print("UNRESTORABLE")
else:
	for i in range(init, init + len_T):
		S_prime[i] = T[i - init]
	
	for i in range(len_S):
		if S_prime[i] == "?":
			print("a", end = "")
		else:
			print(S_prime[i], end = "")