peterverebics/CodeNet_Python_118 huggingface dataset:
t = str(input())

# 最初に??を置換する
t = t.replace('??', 'PD')
# 次に残った?を置換する
t = t.replace('P?' , 'PD')
t = t.replace('D?' , 'DP')
t = t.replace('?P' , 'DP')
t = t.replace('?D' , 'PD')

print(t)
s = input()
s = s.replace("?", "D")

print(s.count("D") + s.count("PD"))
s=input()
for i in s:
    if(i=="?"):
        print("P",end="")
    else:
        print(i,end="")
print()
t = list(input())
t.append("null")

for i in range(1, len(t)-1):
    if t[i-1] == "P" and t[i] == "?":
        t[i] = "D"
    elif t[i+1] == "D" and t[i] == "?":
        t[i] = "P"
    elif t[i+1] == "?" and t[i] == "?":
        t[i] = "P"
    elif t[i] == "?":
        t[i] = "D"

t.remove("null")
print("".join(t))
t = input()
t += "O"

str = []
i=0
while i < len(t):
  if t[i] != "?":
    str.append(t[i])
    i += 1
    continue
  elif t[i] == "?" and t[i+1] == "?":
    str.append("P")
    str.append("D")
    i += 2
  elif t[i-1] == "P" and t[i] == "?":
    str.append("D")
    i+=1
  elif t[i] == "?" and t[i+1] == "D":
    str.append("P")
    i+=1
  else:
    str.append("D")
    i+=1

StrA = "".join(str)
print(StrA[:-1])
def solve():
    t = list(input())
    for i in range(len(t)-1):
        if t[i] == "?":
            t[i] = "D"
    print("".join(t))
    return 0

if __name__ == "__main__":
    solve()
def main():
    T = input()
    # ?D -> PD
    # ?P -> DP
    # ?? -> PD 
    # ??? -> PDD

    T = T.replace("??", "PD")
    T = T.replace("?D", "PD")
    T = T.replace("?P", "DP")
    T = T.replace("?", "D")
    print(T)

if __name__=="__main__":
    main()
T = list(input())
idx = [i for i, x in enumerate(T) if x == '?']
for i,v in enumerate(idx):
    if T[v-1] == "P":
        T[v] = "D"
    elif T[v-1] == "D":
        T[v] = "P" 
print("".join(T))
T=list(input())+["."]
for i in range(len(T)):
    if T[i]=="?":
        if T[i+1]=="D":
            T[i]="P"
        elif T[i+1]=="P":
            T[i]="D"
        elif T[i+1]=="?":
            T[i]="P"
            T[i+1]="D"
        else:
            T[i]="D"
print(*T[:-1],sep="")
import sys
sys.setrecursionlimit(10**6)
t=input()
tl=list(t)
tln=len(t)
x=0
while x != -1:
    x=t.find("?")
    if x == tln-1:
        tl[x]="D"
        t="".join(tl)
        break
    if tl[x-1]=="P":
        tl[x]="D"
    elif tl[x+1]=="?":
        tl[x]="P"
    else:
        tl[x]="D"
    t="".join(tl)
print(t)
t = list(input())

for i, v in enumerate(t):
    if t[i] == "?":
        if i % 2 != 0:
            t[i] = "D"
        if i % 2 == 0:
            if t[i - 1] == "P":
                t[i] = "D"
            elif t[i - 1] == "D":
                t[i] = "P"
            else:
                t[i] = "D"

print(''.join(t))
from collections import deque
a = deque(input() + 'K')

ans = 'K'

while len(a) >0:
    k = a.popleft()
    if k == '?':
        if ans[-1] == 'P' or a[0] == 'P':
            ans += 'D'
        else:
            ans += 'P'
    else:
        ans += k
print(ans[1:-1])
t = list(input())
for i in range(1,len(t)):
    if(t[i] == '?' and t[int(i)-1] == 'D'):
        t[i] = 'P'
    elif(t[i] == '?'):
        t[i] = 'D'
print(''.join(t))
import math
N = input()
LISTSTR = list(N)

ans = ''
for i in range(len(LISTSTR)):
    if i != 0:
        mae = ans[-1]
    str = LISTSTR[i]

    if str == '?' and i == 0:
        ans += 'P'
    elif str != '?':
        ans += str
    elif str == '?' and mae == 'P':
        ans += 'D'
    else:
        ans += 'D'




print(ans)
T = list(input())
count = 0
if T[-1] == '?':
    T[-1] = 'D'
for i in range(len(T) - 1, -1, -1):
    if T[i] == '?':        
        if T[i + 1] == 'D':
            T[i] = 'P'
        elif i + 1 < len(T):
            T[i] = 'D'
print(''.join(T))
t=list(map(str,input().split()))
T=[]
for i in range(len(t[0])):
    T.append(t[0][i])
for i in range(len(T)-1):
    if T[i]=='P' and T[i+1]=='?':
        T[i+1]='D'
    if T[i]=='?' and T[i+1]=='?':
        T[i]='D'
        T[i+1]='D'
    if T[i]=='D' and T[i+1]=='?':
        T[i+1]='D'
U="".join(T)
print(U)
T = input()
for i in range(len(T)):
  if T[i] == '?':
    T[i] == 'D'
print(T)
T = [*input()]
t = []
for i in T:
    if i == "?":
        t.append("D")
    else:
        t.append(i)
print(*t)
table=list(input())
#print(table)
for i in range(len(table)-1):
    #print(table[i])
    if table[i]=="?":
        if table[i-1]=="P":
            print("D",end="")
        
        elif table[i+1]=="D":
            print("P",end="")

    else:
        print(table[i],end="")
if table[-1]=="?":
    print("D",end="")
    


        
else:
    print(table[-1],end="")

print("")
T = input()
if 'D?' in T == True:
  T = replace('D?','DP')
elif 'P?' in T == True:
  T = replace('P?','PD')
print(T)
S = input()

while 1:
    bef = S
    bef = bef.replace("?D", "PD")
    bef = bef.replace("P?", "PD")
    bef = bef.replace("??", "PD")
    if S==bef:
        break
    S = bef
    
print(S)
t = list(input())

for i in range(1, len(t)):
    if t[i] == '?':
        t[i] = 'D'

print(''.join(t))
T = list(input())
S = T[:]
for i in range(len(T)-1):
  if T[i] == 'P' and T[i+1] == '?':
    T[i+1] = 'D'
  if T[i] == 'D' and T[i+1] == '?':
    T[i+1] = 'D'
print(''.join(T))
t = input()

s = ""

last = ""
for i in range(len(t)):
    if t[i] == "P" or t[i] == "D":
        s += t[i]
    else:
        if last == "P":
            s += "D"
        elif i < len(t) - 1 and t[i + 1] == "D":
            s += "P"
        else:
            s += "D"

print(s)
import sys
input=sys.stdin.readline
count=0
res=""
str=input()
list=[]
for i in range(len(str)):
  list.append(str[i])
for i in range(len(str)):
  if str[i]=="?":
    if str[i-1]=="P":
      list[i]="D"
    else:
      if str[i+1]=="P":
        list[i]="D"
      elif str[i+1]=="?":
        list[i]="P"
      else:
        list[i]="D"
for i in range(len(str)):
  res+=list[i]
print(res)
T = list(input())
N = len(T)
for i in range(N):
    if T[i] == '?':
        if 0 <= i-1 and T[i-1] == 'P':
            T[i] = 'D'

for i in range(N):
    if T[i] == '?':
        if i+1 < N and T[i+1] == 'D':
            T[i] = 'P'

t = ''.join(T).replace('??', 'PD')
t.replace('?', 'D')
print(t)
s = str(input())
s_ = list(s)
for i in range(len(s)):
  if s_[i]=='?' and i>0 and s_[i-1]=='P':
    s_[i]='D'
  elif s_[i]=='?' and s_[i]=='D':
    s_[i]='P'
  elif s_[i]=='?':
    s_[i]='P'
S = "".join(s_)
print(S)
t = input()
tt = ''
for i in range(len(t)):
    c = t[i]
    if t[i] == '?':
        c = 'D'
        if i > 0 and t[i - 1] == 'P':
            c = 'D'
        elif i < len(t) - 1 and t[i + 1] == 'D' or i < len(t) - 1 and t[i + 1] == '?':
            c = 'P'
    tt += c
print(tt)
# coding: utf-8
# Your code here!

s = list(input())
t = len(s)
for i in range(len(s)-1):
    if s[-1]=="?" and s[-2]=="D" and i==t-2:
        s[-1]="D"
    elif s[i]=="P"  and s[i+1]=="?":
        s[i+1]='D'
    elif s[i]=="D" and s[i+1]=="?":
        s[i+1]='P'

print("".join(s))
a = input()
k = a.replace("?","D")
print(k.count("D")+k.count("PD"))
s = list(input())

if s[-1] == "?":
    s[-1] = "D"
    
for n in range(len(s)-1):
    if s[n] == "?":
        if s[n+1]=="D" or s[n+1]=="?":
            s[n] = "P"
        else:
            s[n] = "D"
print("".join(s))
t = input()
t2 = t.replace('?D','PD')
t3 = t2.replace('??','PD')
t4 = t3.replace('?','D')
print(t4)
def main():
    T = input()
    ans = T[0]
    for i in range(1,len(T)):
        t = T[i]
        if t=='P' or t=='D':
            ans += t
        else:
            ans += 'D'
    print(ans)
main()
import re
string = input()
string = re.sub("\?\?\?", "DDD", string)
string = re.sub("\?\?", "PD", string)
string = re.sub("\?D", "PD", string)
string = string.replace("?", "D")
print(string)
t = list(input())
ln = len(t)
pre = ""
for i in range(ln-1):
    if(t[i]=='?'):
        t[i] = 'D'
print(''.join(t))
S = list(str(input()))

for i in range(len(S)-1):
    if S[i] == '?':
        if S[i+1] == 'P':
            S[i] = 'D'
        else:
            S[i] = 'P'

if S[len(S)-1] == '?':
    S[len(S)-1] = 'D'

strS = "".join(S)

print(strS)
t = input()
a = 0
s = ''
l = ''
for i, ti in enumerate(t):
    if (i == 0):
        if ti == '?':
            l = 'P'
        else:
            l = ti
    else:
        if ti == '?':
            if l == 'P':
                l = 'D'
            else:
                l = 'P'
        else:
            l = ti
    s += l
print(s)
t = input()
u = list(t)
if u[0] == '?':
    u[0] = 'D'
if u[-1] == '?':
    u[-1] = 'D'
for i in range(1, len(u)-1):
    if u[i] == '?':
        if u[i-1] == 'P':
            u[i] = 'D'
        elif u[i+1] == 'D':
            u[i] = 'P'
T = list(input())

if T[0] == '?':
    T[0] = 'P'

for i in range(1, len(T)-1):
    if T[i] == '?':
        if T[i-1] == 'P':
            T[i] = 'D'
        elif T[i+1] == 'D':
            T[i] = 'P'
        elif T[i+1] == '?':
            T[i] = 'P'
        else:
            T[i] = 'D'

print(T[-1])
if T[-1] == '?':
    T[-1] = 'D'

print(''.join(T))
t= list(input())

for i in range(1, len(t)):
  if t[i-1] == 'P' and t[i] == '?':
    t[i] = 'D'
  elif t[i] == '?' and t[i-1] == 'D':
    t[i] = 'P'
    
print(''.join(t))
import sys
input = sys.stdin.readline
RS = input
RI = lambda x=int: x(RS())
RA = lambda x=int: map(x, RS().split())
RSS = lambda: RS().split()


def solve():
    ans = []
    for i in s:
        if i == "P":
            ans.append("P")
        else:
            ans.append("D")
    print(ans)
    return



s = RS()
solve()
#[int(x) for x in input().split()]
#map(int,input().split())
#for _ in range(int(input())):
x=input()
l=list(x)
c=0
for i in range(len(l)):
	if l[i]=='?':
		if i-1<0:
			l[i]='P'
		elif l[i-1]=='P':
			l[i]='D'
		elif i+1<len(l):
			if l[i+1]=='D':
				l[i]='P'
			elif l[i+1]=='?':
				l[i]='P'
			else:
				l[i]='D'
		else:
			l[i]='D'
print(''.join(l))
t = list(input())
for i in t:
    if i == '?':
        i == 'D'
print(''.join(t))
def repl(t, i, c):
  return t[:i] + c + t[i+1:]

t = input()
if t[len(t)-1] == '?':
  t = repl(t, len(t)-1, 'D')
print(t)
for i in range(len(t)-2, -1, -1):
  if t[i] == '?' and t[i+1] == 'D':
    t = repl(t, i, 'P')
  elif t[i] == '?' and t[i+1] == 'P':
    t = repl(t, i, 'D')
print(t)
t = list(input())
n = len(t)
if n == 1:
  if t == '?':
    t = 'D'
elif n == 2:
  if t != 'PD' or t != 'DP':
    if t == '??':
      t = 'PD'
    else:
      for i in range(2):
        if t[i] == '?':
          t[i] = 'D'
else:
  for i in range(n):
    if t[i] != '?':
      continue
    else:
      t[i] = 'D'

if t == 'D'*n:
  t = 'P' + 'D'*n
print(''.join(t))
import collections
from functools import lru_cache


def solve(s):
    s = [ch for ch in s]
    n = len(s)

    for i in range(n-1, -1, -1):
        if s[i] == "?":
            if i < n-1 and s[i+1] == "D":
                s[i] = "P"
            else:
                s[i] = "D"

    return "".join(s)


s = input().strip()
print(solve(s))
t=input()
ans=""
for i in range(len(t)):
    if t[i]=="?":
        if t[i:i+2]=="??" or t[i:i+2]=="?D":
            ans+="P"
        else:
            ans+="D"
    else:
        ans+=t[i]
print(ans)
s=input()
s_list=list(s)
s_list.append('0')
for i in range(len(s)):
  if s_list[i]=='?':
    if s_list[i+1]=='D' or s_list[i+1]=='?':
      s_list[i]='P'
    else :
      s_list[i]='D'
    
    
s_list.pop()
a="".join(s_list)
print(a)
import re
T = input()
t = re.sub("\?", "D", T)
cnt = t.count("PD") + t.count("D")
print(cnt)
n=list(str(input()))
for i in range(len(n)):
  if n[i]=="?":
    if i==len(n)-1:
      n[i]="D"
    elif n[i+1]=="P":
      n[i]="D"
    elif n[i+1]=="D":
      n[i]="P"
    elif n[i+1]=="?":
      n[i]="P"
      n[i+1]="D"
print("".join(n))
t = list(map(str,input()))
# print(t)
check = 0
for i in range(len(t)):
    # print(i,t[i], check)
    if t[i] == 'P':
        check = 1
    elif t[i] == 'D':
        check = 2
    else:
        if check == 1:
            t[i] = 'D'
            check = 2
        elif check == 2:
            t[i] = 'P'
            check = 1
    # print(i,t[i], check)
ans = ''.join(t)
print(ans)
T=input()
T=[str(t) for t in T]
for a in range(len(T)):
    if T[a]=='?':
        if a+1<=len(T)-1 and T[a+1]=='D':
            T[a]='P'
        elif a-1>=0 and T[a-1]=='P':
            T[a]='D'
        else:
            T[a]='P'
print(''.join(T))
#文字列の入力
S_list = list(input())


if(S_list[len(S_list)-1] == "?"):
  S_list[len(S_list)-1] = "D"

for i in range(len(S_list)-1):
  if(S_list[i] == "?"):
    if(S_list[i+1] == "D"):
      S_list[i] = "P"
    elif(S_list[i+1] == "?"):
      S_list[i] = "P"
      S_list[i+1] = "D"
    else:
      S_list[i] = "D"

print(*S_list, sep="")
S = [j for j in input()]
if S[0] == '?':
    S[0] = 'P'
if S[len(S)-1] == '?':
    S[len(S)-1] = 'D'
for i in range(len(S)):
    if S[i] == '?':
        if S[i-1] == 'P':
            S[i] = 'D'
        else:
            S[i] = 'P'
        if S[i+1] == 'D':
            S[i] = 'P'
print(''.join(S))
t=list(input())
for i in range(len(t)-1):
    if t[i]=="?":
        if t[i+1]=="P":
            t[i]="D"
        elif t[i+1]=="P":
            t[i]="D"
        else:
            t[i]="P"
if t[-1]=="?":
    t[-1]="D"
def solve():
    T = input()
    ans = ""
    for i in range(len(T)):
        if i < len(T) -1 and T[i] + T[i+1] == "?D":
            ans += "P"
        elif T[i] == "?":
            ans += "D"
        else:
            ans += T[i]
    
    print(ans)
            
if __name__ == '__main__':
    solve()
t= list(input())

for i in range(1, len(t)):
  if i == len(t)-1 and t[i] == '?':
    t[i] = 'D'
  elif t[i-1] == 'P' and t[i] == '?':
    t[i] = 'D'
  elif t[i] == '?' and t[i-1] == 'D' and t[i+1] == 'D':
    t[i] = 'P'
  elif t[i] == '?' and t[i-1] == 'D' and t[i+1] == 'P':  
    t[i] = 'D'
    
print(''.join(t))
s=input().strip()
for i in s:
    if(i=="?"):
        print("P",end="")
    else:
        print(i,end="")
print()
t=input()
prevc = t[0]
newt=t[0]
for i in range(1,len(t)):
  if t[i] == '?':
    if prevc == 'P':
      newt+='D'
    else:
      newt+='P'
  else:
    newt+=t[i]
  prevc=newt[i]
print(newt)
T = list(str(input()))
X = []
for i in range(len(T)):
    if T[i] == 'P' :
        X. append('P')
    elif T[i] == 'D' :
        X.append('D')
    elif T[i] == '?' :
        if T[i-1] == 'D' :
            X.append('P')
        elif T[i-1] == 'P' :
            X.append('D')
print(X)
s = input()

while "?" in s:
  s = s.replace("??","PD")
  s = s.replace("?","D")
print(s)
str = input()
length = len(str)
ans = [""] * length
for x in range(length):
    if str[length - (x + 1)] == "P":ans[length - (x + 1)] += "P"
    elif str[length - (x + 1)] == "D":ans[length - (x + 1)] += "D"
    elif str[length - (x + 1)] == "?":
        if x == 0: ans[length - (x + 1)] = "D"
        elif ans[length - x] == "D": ans[length - (x + 1)] = "P"
        elif ans[length - x] == "P": ans[length - (x + 1)] = "D"
print(''.join(ans))
s = input()

s = list(s)

#s = list('PD?D??P')

#print(s)

nagasa = len(s)

for m in range(nagasa):
    for i in s[m]:
        if i == '?':
            s[m] = 'D'
        else:
            pass


#print(s)
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"
s = list(input())
for i in range(len(s)-1):
	if s[i] == "?":
		if s[i+1] == "D":
			s[i] = "P"
		elif s[i+1] == "?":
			s[i] = "P"
			s[i+1] = "D"
			i+=1
		else:
			s[i] = "D"
if s[-1] == "?":
	s[-1] = "D"
print("".join(s))
t = list(map(str,input()))
print(t)
check = 0
for i in range(len(t)):
    # print(i,t[i], check)
    if t[i] == 'P':
        check = 1
    elif t[i] == 'D':
        check = 2
    else:
        if check == 1:
            t[i] = 'D'
            check = 2
        elif check == 2:
            t[i] = 'P'
            check = 1
    # print(i,t[i], check)
ans = ''.join(t)
print(ans)
t = str(input())
s =""
for i in range(len(t)-1):
    if(t[i]=='?'):
        if(t[i+1]=='D')or(t[i+1]=='?'):
            s += "P"
        elif(t[i+1]=='P'):
            s+="D"
    else:
        s+=t[i]
print(s)
T = list(input())+["-1"]
ans = T.copy()
for i in range(len(T)-1):
    s = T[i:i+2]
    if s == ["?","?"]:
        ans[i] = "P"
        ans[i+1] = "D"
    elif s == ["?","D"]:
        ans[i] = "P"
    elif s[0] == "?":
        ans[i] = "D"
print("".join(ans[:-1]))
s = input()
for i in range(len(s)-1):
    if s[i] == "?":
        if s[i+1] == "D":
            print("P", end="")
        elif s[i+1] == "P":
            print("D", end="")
        else:
            print("P", end="")
    else:
        print(s[i], end="")

if s[-1] == "?":
    print("D")
else:
    print(s[-1])
s = input()
a = [str(c) for c in s]
for i in range (len(a)-1):
	if a[i]=='?':
		if a[i+1]=='D' or a[i+1]=='?':
			a[i]='P'
		else:
			a[i]='D'
if a[len(a)-1]=='?':
	a[len(a)-1]='D'
print(*a,sep='')
t = input()
x = len(t)
if x % 2 == 0:
    for i in range(x//2):
        i = 'PD'
        print(i, end='')
    print()
else:
    for j in range(x//2):
        j = 'PD'
        print("{}{}".format(j, "P"), end='')
    print()
if __name__ == "__main__":

    pd = input()

    pd_replace = [s.replace('?','D') for s in pd]

    pd_replace.append(0)

    count = 0
    for i in range(len(pd_replace)):
        if (pd_replace[i] == 'P' and pd_replace[i+1] == 'D'):
            count += 1
        elif(pd_replace[i] == 'D'):
            count += 1

    print(count)
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


t=list(input())
n=len(t)
if t[0]=="?":
    t[0]="D"
for i in range(1,n):
    if t[i]=="?" and t[i-1]=="D":
        t[i]="P"
    if t[i]=="?" and t[i-1]=="P":
        t[i]="D"
T = list(input())
tlen = len(T)

for i in range(1, tlen):
  if T[i] == '?':
    if T[i-1]=='P':
      T[i] = 'D'
    else:
      T[i] = 'P'
      
    if i==tlen-1:
      T[i] = 'D'

      
print(*T,sep='')
t=list(input())
for i in range(1,len(t)):
    if t[i-1]=="D" and t[i]=="?":
        t[i]="P"
    elif t[i]=="?":
        t[i]="D"
print("".join(t))
strs = list(input())
for i in range(len(strs)):
  if strs[i] == "?":
    strs[i] = "D"
print(strs)
t = input()

s = list(t)

for i in range(len(s)):
    if s[i] == '?':
        if i < len(s) - 1 and s[i + 1] == 'D':
            s[i] = 'P'
        else:
            s[i] = 'D'

print(''.join(s))
t = ["0"]+list(input())+["0"]
for i in range(1, len(t) - 1):
    if t[i] == '?':
        if t[i - 1] == "P":
            t[i] = "D"
        elif t[i - 1] == "D":
            t[i] = "D"

import sys

[sys.stdout.write(i) for i in t[1:-1]]
print("")
ss = input()

ans = ''
b = 'P'
for i in range(len(ss)):
  c = ss[len(ss)-1-i]
  if c == '?':
    if b == 'D':
      ans = 'P' + ans
      b = 'P'
    else:
      ans = 'D' + ans
      b = 'D'
  else:
    ans = c + ans
    b = c

print(ans)
S = list(input())

for i in range(len(S) - 1):
    if S[i+1] == "?":
        S[i+1] = "D"

print(''.join(S))
if __name__ == "__main__":
    t = input()
    result = ""
    pre_c = ""
    for curr_c in t:
        curr_c = "D" if pre_c == "P" else "P"
        result += curr_c
        pre_c = curr_c
    print(result)
t = list(input())

for i in range(len(t)-1):
  if t[i] == "P":
    if t[i+1] == "D": continue
    elif t[i+1] =="?": 
      t[i+1] = "D"
  elif t[i] == "?":
    if t[i+1]== "D": 
      t[i]="P"
    elif t[i+1]=="?":
      t[i] = "P"
      t[i+1] = "D"
print("".join(t))
import re
string = input()
string = re.sub("\?D", "PD", string)
string = re.sub("\?\?", "PD", string)
string = string.replace("?", "D")
print(string)
T = list(input())
count = 0
if T[-1] == '?':
    if len(T) % 2 == 0:
        T[-1] = 'D'
    else:
        T[-1] = 'P'
        
for i in range(len(T) - 1, -1, -1):
    if T[i] == '?':        
        if T[i + 1] == 'D':
            T[i] = 'P'
        elif i + 1 < len(T):
            T[i] = 'D'
print(''.join(T))
# coding: utf-8
# Your code here!
word = input()
for i in word:
    if i == '?':
        print('D')
    else:
        print(i)
import sys
input = sys.stdin.readline
RS = input
RI = lambda x=int: x(RS())
RA = lambda x=int: map(x, RS().split())
RSS = lambda: RS().split()


def solve():
    ans = []
    for i in s:
        if i == "P":
            ans.append("P")
        else:
            ans.append("D")
    print("".join(ans))
    return



s = RS()
solve()
s = input()
s = list(str(s))

for i in range(len(s)):
    if s[len(s)-1] == '?':
        s[len(s)-1] = 'D'
    else:
        if s[i] == '?':
            if s[i-1] == 'P':
                s[i] = 'D'
            elif s[i+1] == 'D':
                s[i] = 'P'
            else:
                s[i] = 'D'

print(''.join(s))
T=list(input())
T.append('B')

cnt=0
for i in range(len(T)-1):
    if T[i]=='?':
        if T[i+1]=='D' or T[i+1]=='?':
            T[i]='P'
        else:
            T[i]='D'
    
    if T[i]=='D':
        cnt+=1
        if T[i-1]=='P':
            cnt+=1
T.pop(-1)            
print(''.join(T))
data = input()
data_rep = data.replace("?","D")
a = data_rep.count("D")
b = data_rep.count("PD")
print(a+b)
t=list(input())
n=len(t)
for i in range(n):
  if t[i]=='D':
    continue
  elif t[i]=='P':
    if i<n-1:
      if t[i+1]=='D':
        continue
      elif t[i+1]=='?':
        t[i+1]='D'
  else:
    if i<n-1:
      if t[i+1]=='P':
        t[i]='D'
      elif t[i+1]=='?':
        t[i]='P'
      else:
        t[i]='P'
    else:
      t[i]='D'
print(''.join(t))
t = input()
t = list(t)

if t[0] == "?":
    t[0] = "D"

for i in range(len(t)):
    if t[i] == "?":
        if t[i-1] == "P":
            t[i] = "D"
        elif t[i-1] == "D":
            t[i] = "P"

print("".join(t))
T = list(input())
N = len(T)
for i in range(1,N):
  if T[i] == '?':
    T[i] = 'D'
T="".join(T)
print(T)
T = input()

status = True
while status:
    if "P?" in T:
        T = T.replace("P?","PD")
    else:
        status = False

"""
status3 = True
while status3:
    print(3,T)
    if "?D" in T:
        T = T.replace("?D","PD")
        print(3,True)
    else:
        status3 = False
"""

status2 = True
while status2:
    if "D?" in T:
        T = T.replace("D?","DD")
    else:
        status2 = False

print(T)
import sys
import math
import itertools
s = input()
ans=''
for i in range(len(s)):
    if (i == len(s) - 1):
        if (s[i] == '?'):
            ans += 'D'
        break
    if (s[i] == '?'):
        if (s[i + 1] == 'D' or s[i+1]=='?'):
            ans += 'P'
        else:
            ans+='D'
    else:
        ans += s[i]
print(ans)
from sys import stdin

T = stdin.readline().rstrip()

word = T.replace("?P", "DP").replace("?D", "PD")
word = word.replace("P?", "PD").replace("D?", "DP")
word = word.replace("??", "PD")

print(word)
T = input()
flag = True
mlist = []
    
for i in T:
    if i == "D":
        mlist.append(i)
        flag = False
    elif i == "P":
        mlist.append(i)
        flag = True
    else:
        if flag == True:
            mlist.append("D")
            flag = False
        else:
            mlist.append("P")
            flag = True

print(''.join(mlist))
t = input()
t = t.replace('?', 'P')
t = list(t)
for i in range(1, len(t)):
  if t[i-1] == 'P' and t[i] == 'P':
    t[i] = 'D'
if t[len(t)-1] == 'P':
  t[len(t)-1] = 'D'
print(''.join(t))
S = str(input())
n = S.count('?')
S_split = S.split('?')
print(S_split)
s = ''
output = ''
large = 0
hatena = 0
for i in range(2**n):
    s = S_split[0]
    for j in range(n):
        if ((i >> j) & 1) == 1:
            s = s + 'P' + S_split[j+1]
        else:
            s = s + 'D' + S_split[j+1]
    if s.count('D') + s.count('PD') >= large:
      large = s.count('D') + s.count('PD')
      output = s
print(output)
line = list(input())
N = len(line)
i = 1
for i in range(N):
    if line[i] == "?":
        if line[i-1] == "P":
            line[i] = "D"
        elif i >= 2 and line[i-2] == "D":
            line[i] = "D"
        else:
            line[i] = "P"
print("".join(line))
t = input()
ans = [0]*(len(t))

for i,c in enumerate(t):
    if (i!=0 and c=="?") or (len(t)==1 and t =="?"):
        ans[i] = "D"
    else:
        ans[i] = t[i]
print(*ans,sep="")
t = input()
ans = []

for i in range(len(t)):
    ans.append(t[i])

for i in range(len(t)-1, -1, -1):
    if ans[i] == '?' and i == len(t)-1:
        ans[i] = 'D'
    if ans[i] == '?':
        if ans[i+1] == 'D':
            ans[i] = 'P'
        else:
            ans[i] = 'D'
        
print(''.join(ans))