peterverebics/CodeNet_Python_118 huggingface dataset:
t = input()

ans = []
if t[0] == '?':
    ans.append('D')
else:
    ans.append(t[0])

for i, s in enumerate(t):
    if i == 0:
        continue
    if s == '?':
        if ans[i-1] == 'P':
            ans.append('D')
        else:
            ans.append('P')
    else:
        ans.append(s)

for s in ans:
    print(s, end='')
print('')
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

s = input()
s = s.replace("??",'PD')
s = s.replace("?",'D')
print(s)
T = input()

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

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

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

print(T)
t = list(input())
l = len(t)

for i in range(l):
    if t[i] == "?":
        if i == l-1:
            t[i] = "D"
            print(t[i],end="")
        elif t[i+1] == "P":
            t[i] = "D"
            print(t[i],end="")
        else:
            t[i] = "P"
            print(t[i],end="")
    else:
        print(t[i],end="")
T = list(input())+["a"]
for i in range(len(T)):
    s = T[i:i+2]
    if "?" not in s:
        continue
    else:
        if s == ["?","?"]:
            T[i:i+2] = ["P","D"]
        elif s[0] == "?":
            if s[1] == "D":
                T[i] = "P"
            else:
                T[i] = "D"
print("".join(T[:-1]))
t = input()
t_list = list(t)
cnt = 0
for i in range(len(t_list)):
    if t_list[i] == '?':
        t_list[i] = 'D'
print(t_list)
t = input()
t_replace = [s.replace('?', 'D') for  s in t]
print(t_replace)
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] = 'P'

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

s = list(t)

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

main()
t=list(input())
for i in range(len(t)-1):
    if(t[i]=="?" and t[i+1]=="?"):
        t[i]="P"
        t[i+1]="D"
    elif(t[i]=="?" and t[i+1]=="D" ):
        t[i]="P"
t = ''.join(t)
t=t.replace("?", "D")
print(t)
T=str(input())
cnt=0
count=len(T)-1
for i in T:
    if i=='P':
        cnt=1
        print('P',end='')

    elif i=='D':
        cnt=0
        print('D', end='')
    else:
        if count == i:
            print('D')
        elif cnt==1:
            cnt=0
            print('D', end='')
        else:
            cnt=1
            print('P', end='')
S = input()

new_S = ''

for i, s in enumerate(S):
  if s == '?':
    s = S[0] if i % 2 == 0 else S[1]
  new_S += s

print(new_S)
t = list(input())
count = 0

if t[0] == 'D' or t[0] == '?':
    count += 1

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

print(''.join(t))
t=input()
ans=str()
tmp=""
for s in t:
    if s=="P" or s=="D":
        ans+=s
        tmp=s
    else:
        if tmp=="D":
            ans+="P"
            tmp="P"
        else:
            ans+="D"
            tmp="D"

print(ans)
t = input()
ans = list(t)

if ans[-1] == '?':
  ans[-1] = 'D'

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

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

print("".join(T))
t=input()
ans=""
for i in range(len(t)-1):
    if t[i]=="?":
        if t[i:i+2]=="??":
            ans+="P"
        elif t[i:i+2]=="?D":
            ans+="P"
        else:
            ans+="D"
    else:
        ans+=t[i]

if t[-1]=="?":
    ans+="D"
else:
    ans+=str(t[-1])
print(ans)
l = list(input())
n = len(l)

ans = 0
for i in range(n):
    if l[i] == '?':
        print(l[i])
        if not i==0:
            if l[i-1]=="P":
                l[i] = "D"
                continue
        if not i==n-1:
            if l[i+1] == "D":
                l[i] = "P"
                continue
        l[i] = "D"
        
print("".join(l))
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"
s = list(input())
for i in range(len(s)-1):
	if s[i] == "?":
		if s[i+1] == "D" or s[i+1] == "?":
			s[i] = "P"
		else:
			s[i] = "D"
if s[-1] == "?":
	s[-1] = "D"
print("".join(s))
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

T = rs()

A = list(T)
l = len(A)

for i, c in enumerate(A):
	if c == '?':
		if i < l-1 and A[i+1] == 'D':
			A[i] = 'P'
		else:
			A[i] = 'D'
print(''.join(A))
w = input()
while "?" in w:
  p = w.find("?")
  if w[p-1] == "P":
    w = w.replace("?", "D", 1)
  else:
    w = w.replace("?", "P", 1)
print(w)
def F(s):
    p = s[0]
    PD_count = 0
    for i in range(1,len(s)):
        if s[i] == 'D':
            if p == 'P':
                PD_count += 1
            PD_count += 1
        p = t[i]
    return PD_count

t = input()
D = t.replace('?', 'D')
P = t.replace('?', 'P')
count1 = F(D)
count2 = F(P)
print(D if count1>count2 else P)
T=input()
lis=[T[i] for i in range(len(T))]
for i in range(len(T)):
	if lis[i]=="?":
		if i==0 or lis[i-1]=="P":
			lis[i]="D"
		else:
			lis[i]="P"
k="".join(lis)
print(k)
s = input()
r1 = s.replace('?','D').count('D') + s.replace('?','D').count('PD')
r2 = s.replace('?','P').count('P') + s.replace('?','P').count('PD')
if r1 >= r2:
    print(s.replace('?','D'))
else:
    print(s.replace('?','P'))
t=list(input())
n=len(t)
for i in range(n):
  if t[i]=='D':
    continue
  elif t[i]=='P' and 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'
      else:
        t[i]='P'
    else:
      if t[i]=='?':
        t[i]='D'
print(''.join(t))
s = input()
result = ""
for i in range(len(s)):

    if i == len(s)-1:
        if s[i] == '?':
            result += 'D'
        else:
            result += s[i]
        break

    if s[i] == '?':
        if s[i+1] in ['D', '?']:
            result += 'P'

        else:
            result += 'D'
        continue
    result += s[i]

print(result)
t = input()
lent = len(t)
ans = ""
if t[lent-1] == 'D':
    ans+='D'
elif t[lent-1] == 'P':
    ans+='P'
else:
    ans+='D'
for i in range(2,lent+1):
    if t[lent-i] == 'D':
        ans+='D'
    elif t[lent-i] == 'P':
        ans+='P'
    elif t[lent-i] == '?' and ans[-1] == 'D':
        ans+='P'
    elif t[lent-i] == '?' and ans[-1] == 'P':
        ans+='D'
ans = ans[::-1]
print(ans)
t = input('')

tlist = list(t)
for i in range(len(tlist)):
    if i==0 and tlist[i] == '?':
        tlist[i] = 'D'
    elif i==len(tlist)-1 and tlist[i] == '?':
        tlist[i] = 'D'
    elif tlist[i] == '?':
        if tlist[i-1] == 'P':
            tlist[i] = 'D'
        else:
            tlist[i] = 'P'

print("".join(tlist))
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'
        elif t[i+1]=='P':
            t[i]='D'
        elif t[i+1]=='D':
            t[i]='P'
print(''.join(t))
T = input()
T.replace('?', 'D')

d = T.count('D')
Tc = T.count('PD')
print(d + Tc)
s = input()
n = len(s)
news = []
for l in s:
  news.append(l)
s = news
for i in range(1,n):
  if s[i] == '?':
    s[i] = 'D'
print(''.join(s))
T = input()
ans = ''
for i in range(len(T)):
  if T[i] != '?':
    ans += T[i]
    continue
  if i != 0 and T[i-1] == 'P':
    ans += 'D'
  else:
    if i == len(T)-1:
      ans += 'D'
    elif T[i+1] == '?' or T[i+1] == 'D':
      ans += 'P'
    else:
      ans += 'D'
print(ans)
t = input()
l = len(t)
a = []
b = ""
for i in range(l):
    a.append(t[i])
if a[-1] == "?":
    a[-1] = "D"
for i in range(1, l):
    if a[-i-1] == "?":
        if a[-i] == "P":
            a[-i-1] = "D"
        else:
            a[-i-1] = "P"
for i in range(l):
    b += a[i]
print(b)
T = input()

if "?" in T:
  P = T.replace("?","D")
print(T)
S= input()
res = ""
num_D = 0
for idx,ch in enumerate(S):
  if ch == "D":
    num_D += 1
    res += "D"
  elif ch == "?":
    if idx>0 and res[idx-1]=="P":
      res += "D"
    elif len(S)-1>idx>0 and res[idx-1]=="D" and S[idx+1]=="P":
      res += "D"
    else:
      res += "P"
  else:
    res += "P"
print(res)
T = list(input())
N = len(T)

for i in range(0, N-1):
    if T[i]+T[i+1] == "P?":
        T[i+1] = "D"
    elif T[i]+T[i+1] == "?D":
        T[i] = "P"
    elif T[i]+T[i+1] == "??":
        T[i] = "P"
        T[i+1] = "D"
    elif T[i] == "?":
        T[i] = "D"

print("".join(T))
#!/usr/bin/env python
"""AtCoder nomura 2020: B - Postdocs - 
https://atcoder.jp/contests/nomura2020/tasks/nomura2020_b
"""

__author__ = 'bugttle <bugttle@gmail.com>'

def calc(t):
    return t.count('D') + t.count('PD')

def main():
    T = input()

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


if __name__ == '__main__':
    main()
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'
    elif i>0 and i<N-1 and ans[-1]=='D' and T[i+1]=='P':
      ans=ans+'D'
    elif i<N-1 and T[i+1]=='D':
      ans=ans+'P'
    elif i<N-1 and T[i+1]=='?':
      ans=ans+'PD'
      i+=1
  i+=1
print(ans)
x = list(input().split())
 
 
l_replace = [s.replace('?', 'D') for s in x]
print(l_replace)
t = input()

s = list(t)

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

print(''.join(s))
input = input()

PDpoints = 0

for i in range(len(input)):
    j = i + 1
    if j == len(input):
        break
    if input[j] == '?':
        if input[i] == 'P':
            input = input.replace(input[j], 'D')
        elif input[i] == 'D':
            input = input.replace(input[j], 'D')
print(input)
T = list(str(input()))

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

TL=''.join(T)
print(TL)
T = input()
if T[0] == "?" and len(T) > 1:
    ans = "P"
elif T[0] == "?" and len(T) == 1:
    ans = "D"
else:
    ans = T[0]

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

print(ans)
s=input()
t=s
s_list=list(s)
for i in range(len(t)):
    if t[i]=='?':
        
        if t[i-1]=='D':
            s_list[i]='P'
            print(s[i])
        else:
            s_list[i]='D'
    
s_cha="".join(s_list)            
print(s_cha)
T = input()

T = T.replace('?', 'D')

print(T.count("D")+ T.count("PD"))
S = input()

new_S = ''

temp = ''
for i, s in enumerate(S):
  if s == '?':
    s = 'D' if temp == 'P' else 'P'
  new_S += s
  temp = s

print(new_S)
t=list(input())
if t[-1]=='?':
    t[-1]='D'
for i in range(len(t)):
    if t[i]=='?':
        if t[i-1]=='P':
            t[i]=='D'
        elif 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))
s = input()
t = []
for i in range(len(s)):
    if s[i] == "?":
        if i < len(s) - 1 and s[i + 1] == "?":
            t.append("P")
        else:
            t.append("D")
    else:
        t.append(s[i])
print("".join(t))
pd=list(input())
for i in range(len(pd)-1):
  if pd[i]=='P' and pd[i+1]=='?':
    pd[i+1]='D'
  if i<len(pd)-2:
    if pd[i]=='D' and pd[i+1]=='?' and pd[i+2]=='D':
      pd[i+1]='P'
  if pd[i]=='D' and pd[i+1]=='?':
    pd[i+1]='D'

print(''.join(pd))
T = input()

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


for i in range(len(t)):
    print(t[i] ,end="")
print("")
T = input()

for i in range(len(T)-1):
    if T[i] == '?' and T[i+1] == '?':
        T = T[:i] +'PD' + T[i+2:]

T = T.replace('?', 'D')

print(T)
input = input()

PDpoints = 0

for i in range(len(input)):
    j = i + 1
    if j == len(input):
        break
    if input[i] == '?':
        if input[j] == 'D':
            input = input.replace(input[j], 'P')
        else:
            input = input.replace(input[j], 'P')
    if input[j] == '?':
        if input[i] == 'P':
            input = input.replace(input[j], 'D')
        elif input[i] == 'D':
            input = input.replace(input[j], 'D')
print(input)
t = list(input())
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[-1] == "?":
    t[-1] = "D"
print("".join(t))
T = input()

isPrevP = False
ans = []
for t in T:
    if t == '?':
        if isPrevP:
            ans.append('D')
        else:
            ans.append('P')
    else:
        ans.append(t)

    isPrevP = ans[-1] == 'P'

print(''.join(ans))
T=input()

res = ""
for i in range(len(T)) :
    if (T[i] != "?") :
        res += T[i]
        continue

    if (i != 0) :
        if (T[i-1] == "P") :
            res += "D"
        else :
            res += "D"

print(res)
T = list(input())

try:
    for i in range(len(T)):
        if T[i] == '?':
            if T[i-1] == 'P' or T[i-1] == 'D':
                T[i] = 'D'
            elif T[i-1] == 'D' and T[i+1] == '?':
                T[i] = 'P'
except IndexError:
    T[-1] = 'D'


for t in T:
    print(t,end='')
s = list(input())
pee = ""
for i in range(1,len(s)):
    if s[i-1] == "P" and s[i] == "?":
        s[i] = "D"
    if s[i-1] == "?" and s[i] == "D":
        s[i-1] = "P"
    if s[i-1] == "?" and s[i] == "?":
        s[i-1]="P"
        s[i]="D"
for i in range(1,len(s)):
    if s[i] == "?":
        s[i] = "D"
for i in s:
    pee+=i
if pee == "?":
    print("D")
else:
    print(pee)
T=str(input())
cnt=0
for i in T:
    if i=='P':
        cnt=1
        print('P',end='')

    elif i=='D':
        cnt=0
        print('D', end='')
    else:
        if cnt==1:
            cnt=0
            print('D', end='')
        else:
            cnt=1
            print('P', end='')
T = input()
for i in range(1,len(T)):
    if T[i]=='?':
        if T[i-1]=='P':
            T=T.replace('?','D',1)
        elif T[i-1]=='D':
            T=T.replace('?','P',1)
print(T)
T = list(input())

for i in 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"

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

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


for t in T:
    print(t,end='')
S = list(input())

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

print(''.join(S))
t = str(input())

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

print(t)
s = input()
s1 = ''

for i in range(0,len(s)-1):
	if s[i] == '?' and s[i+1] == '?':
		s1 += 'PD'

	if s[i] == '?' and s[i+1] == 'D':
		s1+= 'P'

	if s[i] == 'P' and s[i+1] == '?':
		s1 += 'PD'

	elif s[i] != '?':
		s1 += s[i]

if len(s1) != len(s):
	s1+=s[-1]

print(s1)
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=re.sub("?", "D",T)
#T.replace('P?P', 'PDP')

print(T)
t = list(input())

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

print(''.join(t))
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 0<now:
    if ket[now]=="?":
        if ket[now+1]=="P":
            ket[now]="D"
        else:
            ket[now]="P"
    now=now-1
print(*ket,sep="")
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"
print(*t,sep="")
T = list(input())
for i in range(len(T)):
    if '?' in T[i]:
        if T[i - 1] == 'D':
            T[i] = 'P'
        elif T[i - 1] == 'P':
            T[i] = 'D'
for j in range(len(T)):
    print(T[j], end = '')
text = input()
data = []

for i in text:
  data.append(i)


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()
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'
		elif i!=0 and a[i-1]!='P':
			a[i]='P'
		else:
			a[i]='D'
if a[len(a)-1]=='?':
	a[len(a)-1]='D'
print(*a,sep='')
t = input()
n = len(t)
l = [i for i in t]
if l[n-1] == '?':
    l[n-1] = 'D'
for i in range(n-1):
    if l[n-i-1] == 'P' and l[n-i-2] == '?':
        l[n-i-2] = 'D'
    if l[n-i-1] == 'D' and l[n-i-2] == '?':
        l[n-i-2] = 'P'
s = ''
for i in range(n):
    s = s + l[i]
print(s)
t = list(input())

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

if t[-1] == "?":
  t[-1] = "D"      
      
print(''.join(t))
T=input()
a=""
i=0
while i<len(T):
  if i==len(T)-1 and T[i]=="?":
    a+="D"
    break
  elif T[i]=="?":
    if T[i+1]=="?":
      a+="PD"
    if T[i+1]=="D":
      a+="P"
      a+=T[i+1]
    if T[i+1]=="P":
      a+="D"
      a+=T[i+1]
    i+=2
  else:
    a+=T[i]
    i+=1
print(a)
T = input()

T = T.replace('?', 'D')

print(T)

print(T.count("D")+ T.count("PD"))
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'
        else:
            ans+=s[i]
        break
    if (s[i] == '?'):
        if (s[i + 1] == 'D' or s[i+1]=='?'):
            ans += 'P'
        else:
            ans+='D'
    else:
        ans += s[i]
print(ans)
s = input()

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

print(ans)
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'
        elif t[i+1]=='P':
            t[i]='D'
        elif t[i+1]=='D':
            t[i]='P'
print(''.join(t))
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with

#A = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
S= str(input())
S=list(S)
if S[-1]=='?':
    S[-1]='D'

for i in reversed(range(len(S)-1)):
    if S[i]=='?':
        if S[i+1] == 'D':
            S[i]="P"
        else:
            S[i]='D'
print(''.join(S))
t = input()
x = len(t)
if x % 2 == 0:
    for i in range(x//2):
        i = 'PD'
        print(i, end='')
    print()
else:
    j = 'PD'*(x//2)+'P'
    print(j, end='')
    print()
T = input().replace('?', 'D')
print(T.count('D')+T.count('PD'))
def main():
    t = input()
    flag = True
    ans = ''
    for c in t:
        if c == 'P':
            ans += c
            flag = True
        elif c == 'D':
            ans += c
            flag = False
        else:
            if flag is True:
                ans += 'D'
            else:
                ans += 'P'
                flag = False
    print(ans)


if __name__ == '__main__':
    main()
T = input()
result = ""

for number, letter in zip(range(len(T)) ,T):
  if letter == "?":
    # 最初の文字が?の時.
    if number == 0:
      result += "P"
    # 一つ前の文字が"D"の時.
    elif result[number - 1] == "D":
      result += "P"
    # 一つ前の文字が"P"の時.
    elif result[number - 1] == "P":
      result += "D"
  else:
    result += letter

print(result)
pd=list(input())
for i in range(len(pd)-1):
  if pd[i]=='P' and pd[i+1]=='?':
    pd[i+1]='D'
  if i<len(pd)-2:
    if pd[i]=='D' and pd[i+1]=='?' and pd[i+2]=='D':
      pd[i+1]='P'
  if i<len(pd)-3:
    if pd[i]=='D' and pd[i+1]=='?' and pd[i+2]=='?' and pd[i+3]=='P':
      pd[i+1],pd[i+2]='P','D'
  if pd[i]=='D' and pd[i+1]=='?':
    pd[i+1]='D'

print(''.join(pd))
T = list(i for i in input())

if len(T) == 1 and T[0] == '?':
  T[0] = 'D'
else:
  for i in range(len(T)):
    if T[i] == '?':
      if T[i-1] == 'P':
        T[i] = 'D'
      else:
        try:
          if T[i+1] == 'D' or T[i+1] == '?':
            T[i] = 'P'
        except:
          T[i] = 'D'

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


for index, value in enumerate(str):
    if (value == '?' and index == len(str) - 1):
        str[index] = 'D'
    elif (value == '?' and str[index + 1] == '?'):
        str[index] = 'P'
        str[index + 1] = 'D'
    elif (value == '?'):
    	str[index] = 'D'


print(''.join(str))
T=input()
res=''
for i in range(len(T)):
	if T[i]=='?':
		if  not i-1<0:
			if res[i-1]=='P':
				res+='D'
			else:
				res+='P'
		else:
			res+='P'
	else:
		res+=T[i]

print(res)
import itertools
import decimal
import math
import collections
import sys
input = sys.stdin.readline

T=input()

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

print(T)
def main():
    t = input()
    for _ in range(len(t) // 2 + 1):
        t = t.replace('?D', 'PD').replace('D?', 'DP').replace('P?', 'PD').replace('?P', 'DP')
    print(t)


if __name__ == '__main__':
    main()