Buggy python submission (verdict: Runtime Error):
t=input()
result=''
for i in range(len(t)):
    if t[i]=='?':
        try:
            if result[i-1]=='P':
                result+='D'
            else:
                result+='P'
        except:
            if  t[i+1]=='P':
                result+='D'
            else:
                result+='P'
    else:
        result+=t[i]
print(result)

Fixed submission:
t=input()
result=''
for i in range(len(t)-1):
    if t[i]=='?':
        try:
            if result[i-1]=='P':
                result+='D'
            else:
                if t[i+1]=='P':
                    result+='D'
                else:
                    result+='P'
        except:
            if t[i+1]=='P':
                result+='D'
            else:
                result+='P'
    else:
        result+=t[i]
if t[len(t)-1]=='?' or  t[len(t)-1]=='D':
    print(result+'D')
else:
    print(result+'P')

Buggy python submission (verdict: Runtime Error):
t=input()
p='A'+t+'A'
result=''
for i in range(len(p)-2):
    if t[i]=='?':
        if result[i-1]=='P'or t[i+1]=='P':
            result+='D'
        else:
            result+='P'
    else:
        result+=t[i]
print(result)

Fixed submission:
t=input()
result=''
for i in range(len(t)-1):
    if t[i]=='?':
        try:
            if result[i-1]=='P':
                result+='D'
            else:
                if t[i+1]=='P':
                    result+='D'
                else:
                    result+='P'
        except:
            if t[i+1]=='P':
                result+='D'
            else:
                result+='P'
    else:
        result+=t[i]
if t[len(t)-1]=='?' or  t[len(t)-1]=='D':
    print(result+'D')
else:
    print(result+'P')

Buggy python submission (verdict: Runtime Error):
t=input()
result=''
for i in range(len(t)):
    if t[i]=='?':
        if result[i-1]=='P'or t[i+1]=='P':
            result+='D'
        else:
            result+='P'
    else:
        result+=t[i]
print(result)

Fixed submission:
t=input()
result=''
for i in range(len(t)-1):
    if t[i]=='?':
        try:
            if result[i-1]=='P':
                result+='D'
            else:
                if t[i+1]=='P':
                    result+='D'
                else:
                    result+='P'
        except:
            if t[i+1]=='P':
                result+='D'
            else:
                result+='P'
    else:
        result+=t[i]
if t[len(t)-1]=='?' or  t[len(t)-1]=='D':
    print(result+'D')
else:
    print(result+'P')

Buggy python submission (verdict: Runtime Error):
t=input()
result=''
for i in range(len(t)):
    if t[i]=='?':
        if result[i-1]=='P':
            result+='D'
        else:
            result+='P'
    else:
        result+=t[i]
print(result)

Fixed submission:
t=input()
result=''
for i in range(len(t)-1):
    if t[i]=='?':
        try:
            if result[i-1]=='P':
                result+='D'
            else:
                if t[i+1]=='P':
                    result+='D'
                else:
                    result+='P'
        except:
            if t[i+1]=='P':
                result+='D'
            else:
                result+='P'
    else:
        result+=t[i]
if t[len(t)-1]=='?' or  t[len(t)-1]=='D':
    print(result+'D')
else:
    print(result+'P')