Buggy python submission (verdict: Runtime Error):
s = list(input())
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="P"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="P"
                    else:
                        s[i]= "D"
print(''.join(s))
            

Fixed submission:
s = list(input())
if len(s) < 2:
    print("D")
    exit()
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="D"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="D"
                    else:
                        s[i]= "D"
print(''.join(s))

Buggy python submission (verdict: Runtime Error):
s = list(input())
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="P"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="P"
                    else:
                        s[i]= "D"
print(''.join(s))
            

Fixed submission:
s = list(input())
if len(s) < 2:
    print("D")
    exit()
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="D"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="D"
                    else:
                        s[i]= "D"
print(''.join(s))

Buggy python submission (verdict: Runtime Error):
s = list(input())
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="P"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="P"
                    else:
                        s[i]= "D"
print(''.join(s))
            

Fixed submission:
s = list(input())
if len(s) < 2:
    print("D")
    exit()
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="D"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="D"
                    else:
                        s[i]= "D"
print(''.join(s))