Buggy python submission (verdict: Runtime Error):
S = list(input())
T = list(input())
if len(S)<len(T):
    print("UNRESTORABLE")
    exit()
l = 0
S = S[::-1]
T = T[::-1]
for s in range(len(S)-len(T)+1):
    if S[s]=="?" or S[s] == T[0]:
        k = 0
        for t in range(len(T)):
            if S[s+t]!="?" and S[s+t]!=T[t]:
                break
            else:
                k+=1
    if k==len(T):
        l = s
        break
if k<len(T):
    print("UNRESTORABLE")
else:
    ans = []
    for i in range(len(S)):
        if l <= i and i < k:
            ans.append(T[i-l])
        elif S[i]=="?":
            ans.append("a")
        else:
            ans.append(S[i])
    print("".join(ans[::-1]))

Fixed submission:
S = list(input())
T = list(input())
if len(S)<len(T):
    print("UNRESTORABLE")
else:
    S = S[::-1]
    T = T[::-1]
    k = 0
    l = 0
    for i in range(len(S)-len(T)+1):
        if S[i]=="?" or S[i]==T[0]:
            k = 0
            for j in range(len(T)):
                if S[i+j]=="?" or S[i+j]==T[j]:
                    k+=1
        if k==len(T):
            l = i
            break
    if k!=len(T):
        print("UNRESTORABLE")
    else:
        ans = []
        for i in range(len(S)):
            if l <= i and i < l+k:
                ans.append(T[i-l])
            elif S[i]=="?":
                ans.append("a")
            else:
                ans.append(S[i])
        print("".join(ans[::-1]))

Buggy python submission (verdict: Runtime Error):
S = list(input())
T = list(input())
if len(S)<len(T):
    print("UNRESTORABLE")
    exit()
l = 0
for s in range(len(S)-len(T)+1):
    if S[s]=="?" or S[s] == T[0]:
        k = 0
        for t in range(len(T)):
            if S[s+t]!="?" and S[s+t]!=T[t]:
                break
            else:
                k+=1
    if k==len(T):
        l = s
        break
if k<len(T):
    print("UNRESTORABLE")
else:
    ans = []
    for i in range(len(S)):
        if l <= i and i < i+k:
            ans.append(T[i-l])
        elif S[i]=="?":
            ans.append("a")
        else:
            ans.append(S[i])
    print("".join(ans))

Fixed submission:
S = list(input())
T = list(input())
if len(S)<len(T):
    print("UNRESTORABLE")
else:
    S = S[::-1]
    T = T[::-1]
    k = 0
    l = 0
    for i in range(len(S)-len(T)+1):
        if S[i]=="?" or S[i]==T[0]:
            k = 0
            for j in range(len(T)):
                if S[i+j]=="?" or S[i+j]==T[j]:
                    k+=1
        if k==len(T):
            l = i
            break
    if k!=len(T):
        print("UNRESTORABLE")
    else:
        ans = []
        for i in range(len(S)):
            if l <= i and i < l+k:
                ans.append(T[i-l])
            elif S[i]=="?":
                ans.append("a")
            else:
                ans.append(S[i])
        print("".join(ans[::-1]))

Buggy python submission (verdict: Runtime Error):
S = list(input())
T = list(input())
l = 0
for s in range(len(S)-len(T)+1):
    if S[s]=="?" or S[s] == T[0]:
        k = 0
        for t in range(len(T)):
            if S[s+t]!="?" and S[s+t]!=T[t]:
                break
            else:
                k+=1
    if k==len(T):
        l = s
        break
if k<len(T):
    print("UNRESTORABLE")
else:
    ans = []
    for i in range(len(S)):
        if l <= i and i < i+k:
            ans.append(T[i-l])
        elif S[i]=="?":
            ans.append("a")
        else:
            ans.append(S[i])
    print("".join(ans))

Fixed submission:
S = list(input())
T = list(input())
if len(S)<len(T):
    print("UNRESTORABLE")
else:
    S = S[::-1]
    T = T[::-1]
    k = 0
    l = 0
    for i in range(len(S)-len(T)+1):
        if S[i]=="?" or S[i]==T[0]:
            k = 0
            for j in range(len(T)):
                if S[i+j]=="?" or S[i+j]==T[j]:
                    k+=1
        if k==len(T):
            l = i
            break
    if k!=len(T):
        print("UNRESTORABLE")
    else:
        ans = []
        for i in range(len(S)):
            if l <= i and i < l+k:
                ans.append(T[i-l])
            elif S[i]=="?":
                ans.append("a")
            else:
                ans.append(S[i])
        print("".join(ans[::-1]))

Buggy python submission (verdict: Runtime Error):
S = list(input())
T = input()
for c in range(len(S),len(T)-1,-1):
    for i in range(len(T)):
        if S[c-len(T)+i]!='?' and S[c-len(T)+i]!=T[i]:
            i = 0
            break
    if i>0:
        for j in range(len(T)):
            S[c-len(T)+j]=T[j]
        break
if i>0:
    for j in S:
        if j=='?':
            print('a',end='')
        else:
            print(j,end='')
else:
    print('UNRESTORABLE',end='')
print()

Fixed submission:
S = list(input())
T = list(input())
if len(S)<len(T):
    print("UNRESTORABLE")
else:
    S = S[::-1]
    T = T[::-1]
    k = 0
    l = 0
    for i in range(len(S)-len(T)+1):
        if S[i]=="?" or S[i]==T[0]:
            k = 0
            for j in range(len(T)):
                if S[i+j]=="?" or S[i+j]==T[j]:
                    k+=1
        if k==len(T):
            l = i
            break
    if k!=len(T):
        print("UNRESTORABLE")
    else:
        ans = []
        for i in range(len(S)):
            if l <= i and i < l+k:
                ans.append(T[i-l])
            elif S[i]=="?":
                ans.append("a")
            else:
                ans.append(S[i])
        print("".join(ans[::-1]))