Problem p03565 (python)

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

yn=""
for i in range(len(sd)-len(t)+1):
    ii=len(sd)-len(t)-i
    yn=""
    for j in range(len(t)):
        if sd[ii+j]!=t[j] and sd[ii+j]!="?":
            yn="NG"
            break
    if yn=="NG":
        continue
    else:
        yn="yes"
        break
    
if yn=="NG" or yn=="": 
    print("UNRESTORABLE")
else:
    for j in range(len(t)):
        sd[ii+j]=t[j]
    for j in range(len(sd)):
        if sd[j]=="?":
           sd[j]="a"
    strt="".join(sd)
    print(strt)

Buggy submission (verdict: Runtime Error):

sd=list(input())
t=list(input())
#strsd="?tc????"
#strt="coder"

#strsd="??p??d??"
#strt="abc"

#strsd="ab??p??c"
#strt="abc"

#sd=list(strsd)
#t=list(strt)

lens=len(sd)
lent=len(t)
yn=""
for i in range(lens-lent,-1,-1):
    yn=""
    for ii in range(lent):
        if sd[i+ii]==t[ii] or sd[i+ii]=="?":
            continue
        else:
            yn="NG"
            break
    if yn!="NG":
        yn="itchi"
        break
    
if yn=="NG":
    print("UNRESTORABLE")
else:
    s=""
    if i!=0:
        for ii in range(i):
            if sd[ii]=="?":
                si="a"
            else:
                si=sd[ii]
            s=s+si
    for ti in t:
        s=s+ti
    if i!=lens-lent:
        for ii in range(i+lent,lens,1):
            if sd[ii]=="?":
                si="a"
            else:
                si=sd[ii]
            s=s+si
    print(s)

Buggy submission (verdict: Runtime Error):
sd=list(input())
t=list(input())
#strsd="?tc????"
#strt="coder"

#strsd="??p??d??"
#strt="abc"

#sd=list(strsd)
#t=list(strt)

lens=len(sd)
lent=len(t)
for i in range(lens-lent,-1,-1):
    yn=""
    for ii in range(lent):
        if sd[i+ii]==t[ii] or sd[i+ii]=="?":
            continue
        else:
            yn="NG"
            break
    if yn!="NG":
        yn="itchi"
        break
    
if yn=="NG":
    print("UNRESTORABLE")
else:
    s=""
    if i!=0:
        for ii in range(i):
            if sd[ii]=="?":
                si="a"
            else:
                si=sd[ii]
            s=s+si
    for ti in t:
        s=s+ti
    if i!=lens-lent:
        for ii in range(i+lent,lens,1):
            if sd[ii]=="?":
                si="a"
            else:
                si=sd[ii]
            s=s+si
    print(s)

Buggy submission (verdict: Runtime Error):
sd=list(input())
t=list(input())
#strsd="?tc????"
#strt="coder"

#strsd="??p??d??"
#strt="abc"

#sd=list(strsd)
#t=list(strt)

lens=len(sd)
lent=len(t)
for i in range(lens-lent,-1,-1):
    yn=""
    for ii in range(lent):
        if sd[i+ii]==t[ii] or sd[i+ii]=="?":
            continue
        else:
            yn="NG"
            break
    if yn!="NG":
        yn="itchi"
        break
    
if yn=="NG":
    print("UNRESTORABLE")
else:
    s=""
    if i!=0:
        for ii in range(i):
            if sd[ii]=="?":
                si="a"
            else:
                si=sd[ii]
            s=s+si
    for ti in t:
        s=s+ti
    if i!=lent-lens:
        for ii in range(i+lent,lens,1):
            if sd[ii]=="?":
                si="a"
            else:
                si=sd[ii]
            s=s+si
    print(s)

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

for i in range(len(sd)-len(t)+1):
    ii=len(sd)-len(t)-i
    yn=""
    for j in range(len(t)):
        if sd[ii+j]!=t[j] and sd[ii+j]!="?":
            yn="NG"
            break
    if yn=="NG":
        continue
    else:
        yn="yes"
        break
    
if yn=="NG": 
    print("UNRESTORABLE")
else:
#    s=sd.copy()
    for j in range(len(t)):
        sd[ii+j]=t[j]
    for j in range(len(sd)):
        if sd[j]=="?":
           sd[j]="a"
    strt="".join(sd)
    print(strt)

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

for i in range(len(sd)-len(t)+1):
    ii=len(sd)-len(t)-i
    yn=""
    for j in range(len(t)):
        if sd[ii+j]!=t[j] and sd[ii+j]!="?":
            yn="NG"
            break
    if yn=="NG":
        continue
    else:
        yn="yes"
        break
    
if yn=="NG": 
    print("UNRESTORABLE")
#elif yn=="": 
#    print("UNRESTORABLE")
#elif yn=="yes":
else:
    s=sd.copy()
    for j in range(len(t)):
        s[ii+j]=t[j]
    for j in range(len(s)):
        if s[j]=="?":
           s[j]="a"
    strt="".join(s)
    print(strt)

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

sd=list(sts)
t=list(ts)

for i in range(len(sd)-len(t)+1):
    ii=len(sd)-len(t)-i
    yn=""
    for j in range(len(t)):
        if sd[ii+j]!=t[j] and sd[ii+j]!="?":
            yn="NG"
            break
    if yn=="NG":
        continue
    else:
        yn="yes"
        break
    
if yn=="NG": 
    print("UNRESTORABLE")
#elif yn=="": 
#    print("UNRESTORABLE")
#elif yn=="yes":
else:
    s=sd.copy()
    for j in range(len(t)):
        s[ii+j]=t[j]
    for j in range(len(s)):
        if s[j]=="?":
           s[j]="a"
    strt="".join(s)
    print(strt)

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

#sts="?tc????"
#ts="coder"

#sts="??p??d??"
#ts="abc"
#sd=list(sts)
#t=list(ts)

for i in range(len(sd)-len(t)+1):
    ii=len(sd)-len(t)-i
    yn=""
    for j in range(len(t)):
        if sd[ii+j]!=t[j] and sd[ii+j]!="?":
            yn="NG"
            break
    if yn=="NG":
        continue
    else:
        yn="yes"
        break
    
if yn=="NG": 
    print("UNRESTORABLE")
elif yn=="": 
    print("UNRESTORABLE")
elif yn=="yes":
    s=sd.copy()
    for j in range(len(t)):
        s[ii+j]=t[j]
    for j in range(len(s)):
        if s[j]=="?":
           s[j]="a"
    strt="".join(s)
    print(strt)

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

#sts="?tc????"
#ts="coder"

#sts="??p??d??"
#ts="abc"
#sd=list(sts)
#t=list(ts)

for i in range(len(sd)-len(t)):
    ii=len(sd)-len(t)-i
    yn=""
    for j in range(len(t)):
        if sd[ii+j]!=t[j] and sd[ii+j]!="?":
            yn="NG"
            break
    if yn=="NG":
        continue
    else:
        yn="yes"
        break
    
if yn=="NG": 
    print("UNRESTORABLE ")
elif yn=="": 
    print("UNRESTORABLE ")
elif yn=="yes":
    s=sd.copy()
    for j in range(len(t)):
        s[ii+j]=t[j]
    for j in range(len(s)):
        if s[j]=="?":
           s[j]="a"
    strt="".join(s)
    print(strt)

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

#sts="?tc????"
#ts="coder"

#sts="??p??d??"
#ts="abc"
#sd=list(sts)
#t=list(ts)

for i in range(len(sd)-len(t)):
    ii=len(sd)-len(t)-i
    yn=""
    for j in range(len(t)):
        if sd[ii+j]!=t[j] and sd[ii+j]!="?":
            yn="NG"
            break
    if yn=="NG":
        continue
    else:
        yn="yes"
        break
    
if yn=="NG": 
    print("UNRESTORABLE")
elif yn=="": 
    print("UNRESTORABLE")
elif yn=="yes":
    s=sd.copy()
    for j in range(len(t)):
        s[ii+j]=t[j]
    for j in range(len(s)):
        if s[j]=="?":
           s[j]="a"
    strt="".join(s)
    print(strt)