peterverebics/CodeNet_Python_118 huggingface dataset:
# -*- coding: utf-8 -*-
t = list(input())
ans = ''.join(t)

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

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

stack = ''
ans = ''
for i in range(len(t)):
    word = t[i]
    if word == '?':
        if len(stack) <= 0:
            word = 'P'
        elif stack[-1] == 'P':
            word = 'D'
        elif stack[-1] == 'D' and i < len(t)-1 and t[i+1] == 'P':
            word = 'D'
        else:
            word = 'D'

    stack += word
    if 'PD' in stack or 'DD' in stack:
        ans += stack
        stack = ''

ans += stack
print(ans)
import math
N = input()
LISTSTR = list(N)

ans = ''
for i in range(len(LISTSTR)):
    if i != 0:
        mae = ans[-1]
    str = LISTSTR[i]
    
    if i == len(LISTSTR):
        ans += 'D'
    elif str == '?' and i == 0:
        ans += 'P'
    elif str != '?':
        ans += str
    elif str == '?' and mae == 'P':
        ans += 'D'
    else:
        ans += 'D'


if len(LISTSTR) == 1:
    ans = 'D'

print(ans)
S = input()

new_S = ''

for i, s in enumerate(S):
  if s == '?' and i > 0:
    s = 'D' if new_S[i - 1] == 'P' else 'P'
  new_S += s
  temp = s

print(new_S)
# B - Postdocs

T = list(str(input()))
len_T = len(T)

for i in range(1, len_T):
    if T[i-1] == 'P' and T[i] == '?':
        T[i] = 'D'
    elif T[i-1] == '?' and T[i] == '?':
        T[i-1] = 'P'
        T[i] = 'D'
    elif T[i-1] == '?' and T[i] == 'D':
        T[i-1] = 'P'
    elif T[i-1] == '?' and T[i] == 'P':
        T[i-1] = 'P'
print(''.join(map(str, T)))
s = input()

ans = 0
for idx in range(len(s)):
    if s[idx] in ['D', '?']:
        ans += 1
    elif s[idx] == 'P' and idx != len(s) - 1 and s[idx+1] == 'D':
        ans += 1

print(ans)
a = input()
t =list(a)
if t[len(t)-1] == "?":
    t[len(t)-1] = "D"
for i in reversed(range(1,len(t)-1)):
    if t[i] == "?" and t[i+1] == "D":
        t[i] = "P"
    elif t[i] == "?":
        t[i] = "D"
if t[0] == "?":
    if t[1] == "D" or t[1] == "?":
        t[0] = "P"
    else:
        t[0] = "D"
answer = "".join(t)
print(answer)
s = list(input())
s.append("a")
for i in range(len(s)):
    if s[i] == "?" and s[i+1] == "?":
        if s[i-1] == "P":
            s[i] = "D"
        else:
            s[i] = "P"

    elif s[i] == "?":
        if s[i-1] == "P":
            s[i] = "D"
        elif s[i+1] == "D":
            s[i] = "P"
print(*s[:-1],sep="")
list=input()
newlist=[list[i: i+1] for i in range(0,len(list))]
T = input()

ans = ""
for i in range(len(T)):
    if(T[i] == "?"):
        if(i != len(T)-1 and T[i+1] == "D"):
            ans += "P"
            continue
        elif(i != 0 and T[i-1] == "?"):
            ans += "P"
            continue
        ans += "D"
    else:
        ans += T[i]
    
print(ans)
s = list(input())
n = len(s)

if n == 1:
    print("D")
elif n == 2:
    print("DP")
else:
    for i in range(1,n-1):
        if s[i] == '?' and s[i+1] == 'D':
            s[i] = 'P'
    for i in range(n):
        if s[i] == '?':
            s[i] = 'D'
    print(''.join(s))
t = list(input())
for i in range(len(t)-1):
    if t[i] == "?":
        if t[i + 1] == "P":
            t[i] = "D"
        else:
            t[i] = "P"
if t[-1] == "?":
    t[-1] = "D"
print("".join(t))
t = list(input())
for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'
print(t)
def main():
    t = input()
    s = t.replace('?D', 'PD').replace('??', 'PD').replace('?', 'D')
    print(s)


if __name__ == '__main__':
    main()
t = input()
ans = [0]*(len(t))

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


print(*ans,sep="")
def main():
    s = list(input())
    for i in range(len(s)):
        if i == 0 and s[0] == "?":
            s[0] = "P"
        elif s[i] == "?":
            s[i] = "D"
    print(*s, sep="")


if __name__ == "__main__":
    main()
t = list(map(str,input()))
tmpP = 0
cnt = 0

for i in t:
    cnt += 1
    if i == "?":
        if tmpP == 1:
            t[cnt-1] = "D"
            tmpP = 0
        else:
            t[cnt-1] = "P"
            tmpP += 1
    elif i == "P":
        tmpP += 1
    else:
        tmpP = 0

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

ans = ''.join(t)  
print(ans)
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 or x == length - 1: 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))
t = input('')
a = ''
n = ''
for i in range(len(t)):
    if t[i] == 'P':
        n = 'D'
        a += t[i]
    if t[i] == 'D':
        n = 'D'
        a += t[i]
    if t[i] == '?':
        a+=n

print(a)
# DDDDDD -> 6
# PDPDPD -> 6
# PDPDPDP -> 3 + 3
# PDDDDDP -> 1 + 5
t = list(input())

for i in range(len(t)):
  if t[i] != "?":
    continue
  else:
    if t[i-1] == "D":
      t[i] = "P"
    if t[i-1] == "P":
      t[i] = "D"
  print(i, t[i])
      
if t[-1] == "?":
  t[-1] = "D"
      
print(''.join(t))
T = input()
k = 0

for i in range(len(T)):
  if T[i] == '?':
    T[i] == 'D'
print(T)
a = input()
s = list(a)

for i in range(len(s)):
  if (a[i] == '?'):
    s[i] = 'D'

print(s)
T = list(input())

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

print(''.join(T))
s = input()
n = len(s)
ans = list(s)
cnt = 0
for i in range(n)[::-1]:
    if ans[i] == '?':
        if i == n-1:
            ans[i] = 'D'
        else:
            if ans[i+1] == 'P':
                ans[i] = 'D'
            else:
                ans[i] = 'P'
            
print(''.join(ans))
T = input()
T= T.replace("D?","DP")
T= T.replace("?","D")
print(T)
import sys
input = sys.stdin.readline
s=input()
s=[s[i] for i in range(len(s))]
s=s[:len(s)-1]
if s[0]=='?':
  s[0]='D'
if s[-1]=='?':
  s[-1]='D'
for i in range(len(s)-2):
  if s[i+1:i+3]==['?','?']:
    s[i+1]='P'
    s[i+2]='D'
  elif s[i]==s[i+2]=='D':
    s[i+1]='P'
  else:
    s[i+1]='D'
print(''.join(s))
def main():
    S = input()
    S = S.replace("?", "P")
    print(S)
if __name__ == "__main__":
    main()
a="PD"*100000+"P"
s=input()
n=len(s)
r=""
c=0
for i in range (n):
    if s[i]=='?':
        c+=1
    else:
        if c%2==0:
            r+=a[0:c]
        else:
            r+=a[1:c+1]
        r+=s[i]
print(r)
T = input()
for i in range(0, len(T)):
    if T[0] == "P":
        first = "P"
        second = "D"
    else:
        first = "D"
        second = "P"

for i in range(0, len(T)):
    if T[i] == "?":
        if i % 2 == 0:
            T = T.replace("?", first)
        else:
            T = T.replace("?", second)
print(T)
T=list(input())


ans=[]
buff="D"

leng=len(T)

for i in range(leng):
    now=T[i]
    if now=="?":
        if (i+1 < leng) and T[i+1] in ["?", "D"]:
            if buff == "P":
                ans.append("D")
            else:
                ans.append("P")
        else:
            ans.append("D")
    else:
        ans.append(now)
    buff=now

print("".join(ans))
# B - Postdocs

T = list(str(input()))
len_T = len(T)

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

print(''.join(map(str, T)))
def main():
    text = input()
    for c in text:
        if c == '?':
            print('D')
        else:
            print(c)


if __name__ == '__main__':
    main()
s = input()
t = ''
if s[0] == '?':
    t = 'P'
else:
    t = s[0]
for i in range(1, len(s)):
    if s[i] == '?':
        if t[-1] == 'P':
            t += 'D'
        else:
            t += 'P'
    else:
        t += s[i]
print(t)
t = input()

list_t = list(t)

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

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

for i in range(len(t)):
  if t[i] != "?":
    continue
  else:
    if t[i-1] == "D":
      t[i] = "P"
    if t[i-1] == "P":
      t[i] = "D"
      
if t[-1] == "?":
  t[-1] = "D"
      
print(''.join(t))
import sys
input = sys.stdin.readline

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


ans = []
for i in s:
    if i == "P":
        ans.append("P")
    else:
        ans.append("D")
print("".join(ans))
t = list(input())

for i in range(len(t)-1):
    # ?が出たら前後の値から考える
    if t[i] == '?':
        if t[i+1] == 'D':
            t[i] = 'P'
        elif t[i+1] == '?' and t[i-1] != 'P':
            t[i] = 'P'
        else:
            t[i] = 'D'
if t[len(t)-1] == '?':
    t[len(t)-1] = 'D'
print("".join(t))
import sys
input = sys.stdin.readline
s=input()
s=[s[i] for i in range(len(s))]
s=s[:len(s)-1]
if s[0]=='?':
  s[0]='D'
if s[-1]=='?':
  s[-1]='D'
for i in range(len(s)-2):
  if s[i+1:i+3]==['?','?']:
    s[i+1]='D'
    s[i+2]='D'
  elif s[i]==s[i+2]=='D':
    s[i+1]='P'
  else:
    s[i+1]='D'
print(''.join(s))
t = list(input())
if t[0] == "?":
    t[0] = "P"
for i in range(1, len(t)):
    if t[i] =="?":
        if t[i-1] == "D":
            t[i] = "P"
        else:
            t[i] = "D"

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

for i in range(len(p) - 1):
  if p[i] == "?":
    if p[i + 1] == "D" or p[i + 1] == "?":
      p[i] = "P"
    else: 
      p[i] = "D" 
  
print("".join(p))
t = input()
t1 = t.replace('?', 'D')
t2 = t.replace('?', 'P')
print(max(t1.count('D') + t1.count('PD'), t2.count('D') + t2.count('PD')))
T=input()

T=list(T)

for i in range(len(T)):
    j=int(i)
    if T[j]=='?':
        T[j]='D'
"".join(T)
print(T)
T = input()

ans = ""
for i in range(len(T)):
    if(T[i] == "?"):
        if(i != len(T)-1 and T[i+1] == "D"):
            ans += "P"
            continue
        elif(i != len(T)-1 and T[i+1] == "?"):
            ans += "P"
            continue
        ans += "D"
    else:
        ans += T[i]
    
print(ans)
t = input()
if t[-1]=='P' or t[-1]=='D': ans = t[-1]
else:ans = 'D'
for i in t[len(t)-2::-1]:
    if i=='P' or i=='D':
        ans += i
    else:
        if ans[-1]=='P':
            ans += 'D'
        else:
            ans += 'P'
print(ans[::-1])
import re 
T=input() 



T=T.replace("???", "DDD")
T=T.replace("??", "DD")

T=T.replace('D?D', 'DPD')
T=T.replace('D?P', 'DDP')
T=T.replace('P?D', 'PDD')
T=T.replace('P?P', 'PDP')

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

T=T.replace('P?', 'PD')
T=T.replace('D?', 'DD')

T=T.replace('?', 'D')
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)
t = list(input())

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

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

ans = ""

for i in range(len(t)):
    ans += t[i]

print(ans)
t = input()
t = t.replace("??", "PD")
t = t.replace("P?", "PD")
t = t.replace("?D", "PD")
t = t.replace("?", "D")
print(t)
t= list(input())

for i in range(1, len(t)):
  if i == len(t)-1 and t[i] == '?':
    t[i] == 'D'
  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))
T=input()
ans=T.count("PD")+T.count("P?")+T.count("D")+T.count("?")
print(ans)
t = str(input())
t0 = t.replace('?','K')
list = [t0]
i=0
while 'K' in list[i]:

    list.append(list[i].replace('DK','DP').replace('PK','PD'))
    i+=1

print(list[i])
t=list(input())
if t[-1]=='?':
    t[-1]='D'
for i in range(len(t)-1):
    if t[i]=='?':
        if t[i+1]=='?':
            t[i]='P'
            t[i+1]='D'
        elif t[i+1]=='D':
            t[i]='P'
        else:
            t[i]='D'
print(''.join(t))
from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

T = input()
t=list(T)
cnt=0
for i in range(len(t)):
    if t[i] == "?":
        if i != 0 and t[i-1] == "P":
            t[i] ="D"
        elif i != len(t)-1 and t[i+1] == "D":
            t[i] = "P"
        else:
            t[i] = "P"

for i in range(len(t)):
    print(t[i] ,end="")
print("")
T=input()
T_len=len(T)
S=list(T)
if S[0]=="?":
    S[0]="P"

for i in range(T_len):
    if S[i]=="?":
        if S[i-1]=="P":
            S[i]="D"
        else:
            S[i]="P"
str_changed = "".join(S)
print(str_changed)
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'
print(''.join(t))
T = input()
lent = len(T)
mlist = []
    
for i in range(lent):
    if T[lent - (i+1)] == "?":
        if i == 0:
            mlist.append("D")
        elif mlist[i-1] == "D":
            mlist.append("P")
        else:
            mlist.append("D")
    else:
        mlist.append(T[lent - (i+1)])

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

    
b=""
for i in range(len(t)):
    b+=t[i]
print(b)
T = input()
l = len(T)
before = 'D'
ans = ''

for i in range(l):
    if i == l - 1:
        if T[i] == '?':
            j = 'D'
        else:
            j = T[i]
        ans = ans + j
        continue
    if T[i] == '?':
        if before == 'P':
            j = 'D'
        else:
            j = 'P'
    else:
        j = T[i]
    ans = ans + j
    before = j
print(ans)
word = input()
start = 0
end = len(word)
while(True):
	i = word.find('?', start, end)
	if (i == -1):
		break
	elif (i == (end-1)):
		word = word.replace('?', "D", 1)   
	elif (word[i-1] == 'P'):
		word = word.replace('?', "D", 1)
	elif ((word[i+1] == "?") or (word[i+1] == "D")):
		word = word.replace('?', "P", 1)
	start = i + 1
print(word)
T = list(input())

for index, i in enumerate(T):
    if i != "?":
        continue
    if index + 1 < len(T):
        if T[index + 1] == "D":
            T[index] = "P"
            continue
    T[index] = "D"
print("".join(T))
T = input()

ans = ""
for i in range(len(T)):
    if(T[i] == "?"):
        if(i != 0 and T[i-1] == "P"):
            ans += "D"
        elif(i != len(T)-1 and T[i+1] == "?"):
            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':
      s_list[i]='P'
    elif s_list[i+1]=='?':
      if s_list[i-1]=='P':
        s_list[i]='D'
      else :
        s_list[i]='P'
    else :
      s_list[i]='D'
    
    
s_list.pop()
a="".join(s_list)
print(a)
import sys
import math
import itertools
s = input()
ans=''
for i in range(len(s)):
    if(s[i]==''):
        ans+='D'
    else:
        ans += s[i]
print(ans)
def main():
    t = input()
    s = t.replace('?D', 'PD').replace('P?', 'PD').replace('??', 'PD').replace('?', 'D')
    print(s)


if __name__ == '__main__':
    main()
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

t = list(readline().decode().rstrip())
if t[-1] == '?':
    t[-1] = 'D'
for i in reversed(range(1, len(t))):
    if t[i] == 'P' and t[i-1] == '?':
        t[i-1] = 'D'
    if t[i] == 'D' and t[i-1] == '?':
        t[i-1] = 'P'

print(''.join(t))
s = input()
ans = 0

p = ""
for i in range(len(s)):
  if s[i]=="?":
    p+="D"
  else:
    p+=s[i]

for i in range(len(s)-1):
  
  if s[i]=="D" and s[i]==s[i+1]:
    ans +=1
  elif s[i]=="P" and s[i+1]=="D":
    ans +=1
print(ans)
t = input()
ans = t.replace('?','P')
ANS = ans.replace(ans[1::2],'D')
print(ANS)
T=input()
list=[]
for j in range(len(T)):
    if T[j]=="?":
        list.append(j)
tt=[]
for TT in range(len(T)):
    tt.append(T[TT])
for i in range(1,len(T)):
    if tt[i-1]=="P":
        tt[i]="D"
    else:
        tt[i]="P"
answer=""
for j in range(len(T)):
    answer+=tt[j]
print(answer)
T_str=input()
T=list(T_str)

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

print("".join(T))
t = input()
a = t[::-1]
s = ''
for i in range(len(t)):
  if i == 0 and a[i] == '?':
    s += 'D'
  else:
    if a[i] != '?':
      s += a[i]
    else:
      if s[-1] == 'D':
        s += 'P'
      else:
        s += 'D'
print(s[::-1])
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()

if "?" in T:
  P = T.count("P")
  D = T.count("D")
  PD = P + D
  print(PD)
else:
  PD = T.count("PD")
  D = T.count("D")
  S = PD + D
  print(S)
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'

print(*T,sep='')
# coding: utf-8
# Your code here!
s = list(input())
#print(s)

for i,j in enumerate(s):
    if j == "?":
        if s[i - 1] == "D":
            s[i] = "P"
        else:
            s[i] = "D"
            
for i in s:
    print(i,end ="")
T = input()
lent = len(T)
mlist = []
    
for i in range(lent):
    if T[lent - (i+1)] == "D":
        mlist.append("D")
    elif T[lent - (i+1)] == "P":
        mlist.append("P")
    else:
        if i == 0 or mlist[i-1] == "P":
            mlist.append("D")
        else:
            mlist.append("P")

mlist.reverse()
print(''.join(mlist))
t = input()
t_replace = [t.replace('?', 'D')]
print(t_replace)
t = input()
t = t.replace('?', 'D')
c_pd = t.count('PD')
c_d = t.count('D')
print(c_pd + c_d)
T = input()
cnt = 0
newT = ''
for j,i in enumerate(T[::-1]):
    if j ==0 and i =='?':
        i = 'D'
    elif i == '?':
        if newT[j-1] == 'P':
            i = 'D'
        else:
            i = 'P'
    newT += i
    
print(newT[::-1])
t = input()
o = ""
for i in range(len(t)):
    if t[i] == "?":
        if i != len(t) - 1:
            if t[i + 1] == "D":
                o += "P"
            else:
                o += "D"
        else:
            o += "D"
    else:
        o += t[i]

print(o)
s = input()
p = list(s) 
if p[len(p) - 1] == "?":
  p[len(p) - 1] = "D"

for i in range(len(p) - 1):
  if p[i] == "?":
    if i == 0:
      if p[i + 1] == "D" or p[i + 1] == "?": 
        p[i] = "P"
      else:
        p[i] = "D"
    elif p[i - 1] == "P":
      p[i] = "D"
    else: 
      p[i] = "P" 
  
print("".join(p))
raw_data = input()               
data = raw_data.replace('?', 'D')
s = list(input())
if s[0] == '?':
  s[0] = "D"
for i in range(1, len(s)):
  if s[i] == '?':
    if s[i-1]== 'D':
      s[i] = 'P'
    else: 
      s[i] = 'D'
print("".join(s))
S=input()
line=[]
word=list(S)
for i in range(len(word)):
    if word[i]=="?":
        if i+1==len(word):
            word[i]="D"
        else:
            if word[i+1]=="D":
                word[i]="P"
            else:word[i]="D"


print("".join(word))
T = input()
ans=[]
if T[-1] == '?':
    ans.append('D')
else:
    ans.append(T[-1])
for k in range(2, len(T)+1):
    if T[-k] == '?':
        if T[-k+1] == "P":
            ans.append("D")
        else:
            ans.append("P")
    else:
        ans.append(T[-k])

a = '' 
for k in range(1, len(ans)+1):
    a += ans[-k]
print(a)
t=input()
now=len(t)-1
kekka=t
ket=[]
for i in range(len(t)):
    ket.append(kekka[i])
if ket[now]=="?":
    ket[now]="D"
    now-=1
while -1<now:
    if ket[now]=="?":
        if ket[now+1]=="P":
            ket[now]="D"
        else:
            ket[now]="P"
    now=now-1
print(*ket,sep="")
T = input()
for i in range(len(T)-1):
    if T[i]=='?':
        if T[i+1]=='D':
            T=T.replace('?','P',1)
        elif T[i+1]=='?':
            T=T.replace('??','PD',1)
        else:
            T=T.replace('?','D',1)
T=T.replace('?','D')
print(T)
if __name__ == "__main__":
    T = input()
    ans = T
    ans = ans.replace("??", 'PD')
    ans = ans.replace("P?", 'PD')
    ans = ans.replace("?D", 'PD')
    ans = ans.replace("?", 'D')
    print(ans)
T=input()
T_len=len(T)
S=list(T)
if S[0]=="?":
    S[0]="D"

for i in range(T_len):
    if S[i]=="?":
        if S[i-1]=="P":
            S[i]="D"
        else:
            S[i]="P"
str_changed = "".join(S)
print(str_changed)
s=input().replace("?","D");print(s.count("PD")+s.count("D"))
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"

count = 0

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

print(count)
T = input()

S = T.replace("?", "D")

print(S.count("D")+S.count("PD"))
t = input()
n = len(t)
moji = ""
res = ""
if t[-1] ==  "?":
    moji = "P"
    
for i in range(n-1, -1, -1):
    if t[i] == "?":
        if moji == "D":
            res += "P"
        elif moji == "P":
            res += "D"
    else:
        res += t[i]
    moji = res[-1]
res = res[::-1]
print(res)
text = input()
data = []

for i in text:
  data.append(i)

print()

for d in range(0,len(text)):
  if data[d] == "?" and data[d-1] == "P":
    data[d] = "D"
  elif data[d] == "?":
    data[d] = "P"

ans = ''.join(data)

print(ans)
s = input()

r_s = s[::-1]
rev = r_s[0]

ans = ""
if r_s[0] == "?":
    ans += "D"
else:
    ans += r_s[0]

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

print(ans[::-1])
T=input()
L=len(T)
if L==1:
  if T=='?': print('D')
  else: print(T)
else:
  X=list(T)
  for i in range(L-1):
    if T[i]=='?':
      if T[i+1]=='P':X[i]='D'
      else:X[i]='P'
  if T[-1]=='?':X[-1]='D'
  print("".join(X))
import re 
T=input() 


T=T.replace("???", "DDD")
T=T.replace("??", "DD")

T=T.replace('D?D', 'DPD')
T=T.replace('D?P', 'DDP')
T=T.replace('P?D', 'PDD')
T=T.replace('P?P', 'PDP')

#T=re.sub("?", "D",T)
#T.replace('P?P', 'PDP')

print(T)
T=input()
ans=''
i=0
N=len(T)
while i<N:
  if T[i]!='?':
    ans=ans+T[i]
  else:    
    if i>0 and ans[-1]=='P':
      ans=ans+'D'
    if i<N-1 and T[i+1]=='D':
      ans=ans+'P'
    if i<N-1 and T[i+1]=='?':
      ans=ans+'PD'
      i+=1
  i+=1
print(ans)
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+='D'
  else:
    newt+=t[i]
  prevc=newt[i]
print(newt)