Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0]) or "?"]

if n_s >= n_t:
  for i in base:
    if n_s - i >= n_t:
      sign = 0
      for j in range(i,i+n_t):
        if not ((s[j] == t[j-i]) or (s[j] == "?")):
          sign = 1
        
      if sign == 0:
        last_num = i

  if last_num != -1:
    for i in range(last_num,last_num + n_t):
      if s[i] == "?":
        s[i] = t[i-last_num]
    
    if s[0] == "?":
      ans = "a"
      
    for j in range(1,n_s):
      if s[j] == "?":
        s[j] = "a"
      ans = ans + s[j]
    
  elif last_num == -1:
    ans = "UNRESTORABLE"

else:
  ans = "UNRESTORABLE"

print(ans)

Fixed submission:
s = list(input())
t = list(input())

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0]) or "?"]

if n_s >= n_t:
  for i in base:
    if n_s - i >= n_t:
      sign = 0
      for j in range(i,i+n_t):
        if not ((s[j] == t[j-i]) or (s[j] == "?")):
          sign = 1
        
      if sign == 0:
        last_num = i

  if last_num != -1:
    for i in range(last_num,last_num + n_t):
      if s[i] == "?":
        s[i] = t[i-last_num]
    
    if s[0] == "?":
      ans = "a"
    else:
      ans = str(s[0])
                  
    for j in range(1,n_s):
      if s[j] == "?":
        s[j] = "a"
      ans = ans + s[j]
    
  elif last_num == -1:
    ans = "UNRESTORABLE"

else:
  ans = "UNRESTORABLE"

print(ans)

Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0])]

if n_s >= n_t:
  for i in base:
    if n_s - i >= n_t:
      sign = 0
      for j in range(i,i+n_t):
        if not ((s[j] == t[j-i]) or (s[j] == "?")):
          sign = 1
        
      if sign == 0:
        last_num = i

  if last_num != -1:
    for i in range(last_num,last_num + n_t):
      if s[i] == "?":
        s[i] = t[i-last_num]
    
    if s[0] == "?":
      ans = "a"
      
    for j in range(1,n_s):
      if s[j] == "?":
        s[j] = "a"
      ans = ans + s[j]
    
  elif last_num == -1:
    ans = "UNRESTORABLE"

else:
  ans = "UNRESTORABLE"

print(ans)

Fixed submission:
s = list(input())
t = list(input())

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0]) or "?"]

if n_s >= n_t:
  for i in base:
    if n_s - i >= n_t:
      sign = 0
      for j in range(i,i+n_t):
        if not ((s[j] == t[j-i]) or (s[j] == "?")):
          sign = 1
        
      if sign == 0:
        last_num = i

  if last_num != -1:
    for i in range(last_num,last_num + n_t):
      if s[i] == "?":
        s[i] = t[i-last_num]
    
    if s[0] == "?":
      ans = "a"
    else:
      ans = str(s[0])
                  
    for j in range(1,n_s):
      if s[j] == "?":
        s[j] = "a"
      ans = ans + s[j]
    
  elif last_num == -1:
    ans = "UNRESTORABLE"

else:
  ans = "UNRESTORABLE"

print(ans)

Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0])]

for i in base:
  if n_s - i >= n_t:
    sign = 0
    for j in range(i,i+n_t):
      if not ((s[j] == t[j-i]) or (s[j] == "?")):
        sign = 1
        
    if sign == 0:
      last_num = i

if last_num != -1:
  for i in range(last_num,last_num + n_t):
    if s[i] == "?":
      s[i] = t[i-last_num]
    
  if s[0] == "?":
    ans = "a"
      
  for j in range(1,n_s):
    if s[j] == "?":
      s[j] = "a"
    ans = ans + s[j]
    
elif last_num == -1:
  ans = "UNRESTORABLE"
  
print(ans)

Fixed submission:
s = list(input())
t = list(input())

n_s = len(s)
n_t = len(t)
last_num = -1

base = [i for i,x in enumerate(s) if x == str(t[0]) or "?"]

if n_s >= n_t:
  for i in base:
    if n_s - i >= n_t:
      sign = 0
      for j in range(i,i+n_t):
        if not ((s[j] == t[j-i]) or (s[j] == "?")):
          sign = 1
        
      if sign == 0:
        last_num = i

  if last_num != -1:
    for i in range(last_num,last_num + n_t):
      if s[i] == "?":
        s[i] = t[i-last_num]
    
    if s[0] == "?":
      ans = "a"
    else:
      ans = str(s[0])
                  
    for j in range(1,n_s):
      if s[j] == "?":
        s[j] = "a"
      ans = ans + s[j]
    
  elif last_num == -1:
    ans = "UNRESTORABLE"

else:
  ans = "UNRESTORABLE"

print(ans)