Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
m = len(S)
n = len(T)

ans = 0
if m >= n:
    for i in range(m+1-n):
        for j in range(n):
            if S[i+j] != T[j] and S[i+j] != "?":
                break
        else:
            S = S[0:i] + T + S[i+n+1:]
            ans = 1

if ans == 1:
    print(S.replace("?", "a"))
else:
    print("UNRESTORABLE") 

Fixed submission:
S = input()
T = input()
m = len(S)
n = len(T)

Sa = []

if m >= n:
    for i in range(m+1-n):
        for j in range(n):
            if S[i+j] != T[j] and S[i+j] != "?":
                break
        else:
            s = S[:i] + T + S[i+n:]
            Sa.append(s.replace("?", "a"))
            

if Sa:
    print(min(Sa))
else:
    print("UNRESTORABLE")

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

sl = list(S)
tl = list(T)
n = len(tl)
w = "?" * n

ans = 0
if len(S) >= n:
    if w in S:
        ans = 1
        S.replace(w, T)
        sl = list(S)
    for i in range(n):
        if tl[i] in sl:
            j = sl.index(tl[i])
            #print(j, tl[i])
            sl2 = sl[j-i:j]
            sl2.extend(sl[j+1:j+n-i])
            #print(sl2)
            tl2 = tl[0:i]
            tl2.extend(tl[i+1:])
            #print(tl2)
            #print(sl2)
            # #print(tl)
            for k in range(len(tl2)):
                if  sl2[k] != tl2[k] and sl2[k] != "?":
                    break
                ans = 1
                sl[j-i:j] = tl2[0:i]
                sl[j+1:j+n-i] = tl[i+1:] 
#print(ans)
S = "".join(sl)
#print(S)

if ans == 1:
    A = S.replace("?", "a")
    print(A)
else:
    print("UNRESTORABLE")

Fixed submission:
S = input()
T = input()
m = len(S)
n = len(T)

Sa = []

if m >= n:
    for i in range(m+1-n):
        for j in range(n):
            if S[i+j] != T[j] and S[i+j] != "?":
                break
        else:
            s = S[:i] + T + S[i+n:]
            Sa.append(s.replace("?", "a"))
            

if Sa:
    print(min(Sa))
else:
    print("UNRESTORABLE")

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

sl = list(S)
tl = list(T)
n = len(tl)
w = "?" * n

ans = 0

if w in S:
  ans = 1
  S.replace(w, T)
  sl = list(S)
for i in range(n):
    if tl[i] in sl:
        j = sl.index(tl[i])
        try:
            sl2 = sl[j-i:j+n-i]
        except:
            continue
        #print(sl2)
        # #print(tl)
        for k in range(n):
            if  sl2[k] != tl[k] and sl2[k] != "?":
                break
            ans = 1
            sl[j-i:j+n-i] = T

S = "".join(sl)
#print(S)

if ans == 1:
    A = S.replace("?", "a")
    print(A)
else:
    print("UNRESTORABLE") 


      


Fixed submission:
S = input()
T = input()
m = len(S)
n = len(T)

Sa = []

if m >= n:
    for i in range(m+1-n):
        for j in range(n):
            if S[i+j] != T[j] and S[i+j] != "?":
                break
        else:
            s = S[:i] + T + S[i+n:]
            Sa.append(s.replace("?", "a"))
            

if Sa:
    print(min(Sa))
else:
    print("UNRESTORABLE")

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

sl = list(S)
tl = list(T)
n = len(tl)
w = "?" * n

ans = 0

if w in S:
  ans = 1
  S.replace(w, T)
  sl = list(S)
for i in range(n):
  if tl[i] in sl:
    j = sl.index(tl[i])
    sl2 = sl[j-i:j+n-i]
    #print(sl2)
    #print(tl)
    for k in range(n):
      if  sl2[k] != tl[k] and sl2[k] != "?":
        break
      ans = 1
      sl[j-i:j+n-i] = T

S = "".join(sl)
#print(S)

if ans == 1:
    A = S.replace("?", "a")
    print(A)
else:
    print("UNRESTORABLE") 

Fixed submission:
S = input()
T = input()
m = len(S)
n = len(T)

Sa = []

if m >= n:
    for i in range(m+1-n):
        for j in range(n):
            if S[i+j] != T[j] and S[i+j] != "?":
                break
        else:
            s = S[:i] + T + S[i+n:]
            Sa.append(s.replace("?", "a"))
            

if Sa:
    print(min(Sa))
else:
    print("UNRESTORABLE")