Buggy python submission (verdict: Runtime Error):
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Fixed submission:
import sys
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

if len(T)==1:
    print("D")
    sys.exit(0)

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Buggy python submission (verdict: Runtime Error):
import sys
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

if len(Q)==0:
    ptint("".join(map(str, T)))
    sys.exit(0)
for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Fixed submission:
import sys
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

if len(T)==1:
    print("D")
    sys.exit(0)

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Buggy python submission (verdict: Runtime Error):
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Fixed submission:
import sys
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

if len(T)==1:
    print("D")
    sys.exit(0)

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Buggy python submission (verdict: Runtime Error):
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Fixed submission:
import sys
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

if len(T)==1:
    print("D")
    sys.exit(0)

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))