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

flag = True
s_len = len(s)
t_len = len(t)
max_ha = 0
l = []
max_save = 0
save = 0
count = 0

for i in range(s_len):
    if s[i] == '?':
        s[i] = 'a'
        count += 1
        max_ha += 1
        max_save = i
        if count == t_len and flag:
            save = i - count + 1
            flag = False
    elif count < t_len and s[i] == t[count]:
        l.append([max_ha, max_save])
        max_ha = 0
        count += 1
        if count == t_len and flag:
            save = i - count + 1
            flag = False
    else:
        l.append([max_ha, max_save])
        max_ha = 0
        count = 0

max_ha, max_save = max(l)        
        
if t_len < max_ha:
    for j in range(t_len):
        s[max_save-j] = t[t_len-j-1]
else:
    for j in range(t_len):
        s[j+save] = t[j]

if flag:
    print("UNRESTORABLE")
else:
    print(s)

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

ls = len(s)
lt = len(t)
match = -1

for i in range(ls-lt+1):
    for j in range(lt):
        if s[i+j] == t[j] or s[i+j] == '?':
            pass
            #continueはここで処理が終わってしまう
        else:
            break
            
        if j == lt - 1:
            match = i
        
for i in range(ls):
    if s[i] == '?':
        s[i] = 'a'
        
for i in range(lt):
    s[match+i] = t[i]
        
if match < 0:
    print("UNRESTORABLE")
else:
    print(''.join(s))

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

flag = True
s_len = len(s)
t_len = len(t)
save = 0
count = 0

for i in range(s_len):
    if s[i] == '?':
        s[i] = 'a'
        count += 1
        if count == t_len and flag:
            save = i - count + 1
            flag = False
    elif count < t_len and s[i] == t[count]:
        count += 1
        if count == t_len and flag:
            save = i - count + 1
            flag = False
    else:
        count = 0
        
for j in range(t_len):
    s[j+save] = t[j]

if flag:
    print("UNRESTORABLE")
else:
    print(s)

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

ls = len(s)
lt = len(t)
match = -1

for i in range(ls-lt+1):
    for j in range(lt):
        if s[i+j] == t[j] or s[i+j] == '?':
            pass
            #continueはここで処理が終わってしまう
        else:
            break
            
        if j == lt - 1:
            match = i
        
for i in range(ls):
    if s[i] == '?':
        s[i] = 'a'
        
for i in range(lt):
    s[match+i] = t[i]
        
if match < 0:
    print("UNRESTORABLE")
else:
    print(''.join(s))

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

flag = True
s_len = len(s)
t_len = len(t)
save = 0
count = 0

for i in range(s_len):
    if s[i] == '?':
        s[i] = 'a'
        count += 1
        if count == t_len and flag:
            save = i - count + 1
            flag = False
    elif s[i] == t[count]:
        count += 1
        if count == t_len and flag:
            save = i - count + 1
            flag = False
    else:
        count = 0
        
for j in range(t_len):
    s[j+save] = t[j]

if flag:
    print("UNRESTORABLE")
else:
    print(s)

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

ls = len(s)
lt = len(t)
match = -1

for i in range(ls-lt+1):
    for j in range(lt):
        if s[i+j] == t[j] or s[i+j] == '?':
            pass
            #continueはここで処理が終わってしまう
        else:
            break
            
        if j == lt - 1:
            match = i
        
for i in range(ls):
    if s[i] == '?':
        s[i] = 'a'
        
for i in range(lt):
    s[match+i] = t[i]
        
if match < 0:
    print("UNRESTORABLE")
else:
    print(''.join(s))