Buggy python submission (verdict: Runtime Error):
import copy
S=list(input())
S1 = "".join(S)
T=list(input())
T1 = "".join(T)
F = ["?"]*len(T)
F1 = "".join(F)
l =[]
M =[]
index =[]
B = copy.deepcopy(S)
while -1<S1.find(F1):
    a = S1.find(F1)
    index.append(a)
    B[a] ="a"
    S1="".join(B)
S1 ="".join(S)
for i in range(len(S)-len(T)+1):
    if S[i]==T[0]:
        l.append(i)
if 0<len(l):
    for i in l:
        A = copy.deepcopy(S)
        c = A[i:len(T)+i]
        while "?" in c:
            c[c.index("?")] = T[c.index("?")]
        if c==T:
            A = copy.deepcopy(S)
            A[i:len(T)+i] = c
            while "?"in A:
                A[A.index("?")]="a"
            M.append(A)

for i in range(len(S)-len(T)+1):
    if S[i] =="?":
        A = copy.deepcopy(S)
        c = A[i:len(T)+i]
    while "?" in c:
        c[c.index("?")] = T[c.index("?")]
    if c==T:
        A = copy.deepcopy(S)
        A[i:len(T)+i] = c
        while "?"in A:
            A[A.index("?")]="a"
        M.append(A)
if 0<len(index):
    for i in index:
        A = copy.deepcopy(S)
        A[i:len(T)+i] = T
        while "?"in A:
            A[A.index("?")]="a"
        M.append(A)
if 0<len(M):
    M.sort()
    print("".join(M[0]))
else:
    print("UNRESTORABLE")

Fixed submission:
import copy
S=list(input())
S1 = "".join(S)
T=list(input())
T1 = "".join(T)
F = ["?"]*len(T)
F1 = "".join(F)
l =[]
M =[]
index =[]
B = copy.deepcopy(S)
for i in range(len(S)-len(T)+1):
    A = copy.deepcopy(S)
    c = A[i:len(T)+i]
    while "?" in c:
        c[c.index("?")] = T[c.index("?")]
    if c==T:
        A = copy.deepcopy(S)
        A[i:len(T)+i] = c
        while "?"in A:
            A[A.index("?")]="a"
        M.append(A)
if 0<len(M):
    M.sort()
    print("".join(M[0]))
else:
    print("UNRESTORABLE")

Buggy python submission (verdict: Runtime Error):
import copy
S=list(input())
S1 = "".join(S)
T=list(input())
T1 = "".join(T)
F = ["?"]*len(T)
F1 = "".join(F)
l =[]
M =[]
index =[]
B = copy.deepcopy(S)
while -1<S1.find(F1):
    a = S1.find(F1)
    index.append(a)
    B[a] ="a"
    S1="".join(B)
S1 ="".join(S)
for i in range(len(S)-len(T)+1):
    if S[i]==T[0]:
        l.append(i)
if 0<len(l):
    for i in l:
        c = S[i:len(T)+i]
        while "?" in c:
            c[c.index("?")] = T[c.index("?")]
        if c==T:
            A = copy.deepcopy(S)
            A[i:len(T)+i] = c
            while "?"in A:
                A[A.index("?")]="a"
            M.append(A)

for i in range(len(S)-len(T)+1):
    if S[i] =="?":
        c = S[i:len(T)+i]
    while "?" in c:
        c[c.index("?")] = T[c.index("?")]
    if c==T:
        A = copy.deepcopy(S)
        A[i:len(T)+i] = c
        while "?"in A:
            A[A.index("?")]="a"
        M.append(A)
if 0<len(index):
    for i in index:
        A = copy.deepcopy(S)
        A[i:len(T)+i] = T
        while "?"in A:
            A[A.index("?")]="a"
        M.append(A)
if 0<len(M):
    M.sort()
    print("".join(M[0]))
else:
    print("UNRESTORABLE")

Fixed submission:
import copy
S=list(input())
S1 = "".join(S)
T=list(input())
T1 = "".join(T)
F = ["?"]*len(T)
F1 = "".join(F)
l =[]
M =[]
index =[]
B = copy.deepcopy(S)
for i in range(len(S)-len(T)+1):
    A = copy.deepcopy(S)
    c = A[i:len(T)+i]
    while "?" in c:
        c[c.index("?")] = T[c.index("?")]
    if c==T:
        A = copy.deepcopy(S)
        A[i:len(T)+i] = c
        while "?"in A:
            A[A.index("?")]="a"
        M.append(A)
if 0<len(M):
    M.sort()
    print("".join(M[0]))
else:
    print("UNRESTORABLE")

Buggy python submission (verdict: Runtime Error):
import copy
S=list(input())
S1 = "".join(S)
T=list(input())
T1 = "".join(T)
F = ["?"]*len(T)
F1 = "".join(F)
l =[]
M =[]
index =[]
B = copy.deepcopy(S)
while -1<S1.find(F1):
    a = S1.find(F1)
    index.append(a)
    B[a] ="a"
    S1="".join(B)
S1 ="".join(S)
for i in range(len(S)-len(T)+1):
    if S[i]==T[0]:
        l.append(i)
if 0<len(l):
    for i in l:
        c = S[i:len(T)+i]
        while "?" in c:
            c[c.index("?")] = T[c.index("?")]
        if c==T:
            A = copy.deepcopy(S)
            A[i:len(T)+i] = c
            while "?"in A:
                A[A.index("?")]="a"
            M.append(A)
else :
    for i in range(len(S)-len(T)+1):
        if S[i] =="?":
            c = S[i:len(T)+i]
        while "?" in c:
            c[c.index("?")] = T[c.index("?")]
        if c==T:
            A = copy.deepcopy(S)
            A[i:len(T)+i] = c
            while "?"in A:
                A[A.index("?")]="a"
            M.append(A)
if 0<len(index):
    for i in index:
        A = copy.deepcopy(S)
        A[i:len(T)+i] = T
        while "?"in A:
            A[A.index("?")]="a"
        M.append(A)
if 0<len(M):
    M.sort()
    print("".join(M[0]))
else:
    print("UNRESTORABLE")

Fixed submission:
import copy
S=list(input())
S1 = "".join(S)
T=list(input())
T1 = "".join(T)
F = ["?"]*len(T)
F1 = "".join(F)
l =[]
M =[]
index =[]
B = copy.deepcopy(S)
for i in range(len(S)-len(T)+1):
    A = copy.deepcopy(S)
    c = A[i:len(T)+i]
    while "?" in c:
        c[c.index("?")] = T[c.index("?")]
    if c==T:
        A = copy.deepcopy(S)
        A[i:len(T)+i] = c
        while "?"in A:
            A[A.index("?")]="a"
        M.append(A)
if 0<len(M):
    M.sort()
    print("".join(M[0]))
else:
    print("UNRESTORABLE")