peterverebics/CodeNet_Python_118 huggingface dataset:
t = input()
u = list(t)
for i in range(len(u)):
    if u[i] == '?':
        u[i] = 'P'
        tmp = ''.join(u).count('D') + ''.join(u).count('PD')
        u[i] = 'D'
        tmp2 = ''.join(u).count('D') + ''.join(u).count('PD')
        print(tmp, tmp2)
        if tmp > tmp2:
            u[i] = 'P'
        else:
            u[i] = 'D'
print(''.join(u))
t = input()
ans = [0]*(len(t))

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

print(*ans,sep="")
t = list(input())
a = 0
b = 0

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

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

T=list(T)

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

print("".join(T))
t = input().rstrip()

s = ''
for i, tt in enumerate(t):
    if t[i] == '?':
        if  i + 1 < len(t) and t[i + 1] == 'D':
            s += 'P'
        else:
            s += 'D'
    else:
        s += tt
print(s)
n=input()
m=len(n)
l=n.count("?")
for i in range(l):
  s=n.find("?")
  if s+1<m:
    if n[s+1]=="P":
      n=n[:s]+"D"+n[s+1:]
    else:
      n=n[:s]+"P"+n[s+1:]
  else:
    if n[s-1]=="P":
      n=n[:s]+"D"+n[s+1:]
    else:
      n=n[:s]+"P"+n[s+1:]
print(n)
T = input()
T = T.replace('?', 'D')
x = T.count('PD')
y = T.count('D')
ans = x + y
print(ans)
def main():
    T = input()

    ans = ''
    if T[-1] != '?':
        ans += T[-1]
    else:
        ans += 'D'

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

    print(ans[::-1])


if __name__ == "__main__":
    main()
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'


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

print(ans)
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()
x = t.replace("?", "D")
print(t.count("D")+t.count("PD"))
T=list(input())
S=[]
if T[0]=="?":
  S.append("P")
for i in range(len(T)):
  if T[i]=="P" or T[i]=="D":
    S.append(T[i])
  if T[i]=="?":
    if S[i-1]=="P":
      S.append("D")
    else:
      S.append("P")
P=''.join(S)
print(P)
T = input()
k = 0

T = T.replace('?','D')
#print(T)
k += T.count('D')
k += T.count('PD')
print(k)
#デフォルト
import itertools
from collections import defaultdict
import collections
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

t = list(input())

for i in range(len(t)):
    if (t[i] == "?"):
        print("D")
    else:
        print(t[i])
t=input()
t=t.replace('??','PD')
t=t.replace('?D','PD')
t=t.replace('?','D')
print(t)
T = input()

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

print(t.count("D")+t.count("PD"))
import numpy as np
t = input()
def func(i):
  if t[i]=='?':
    return 'D'
  else:
  	return t[i]
a = [func(i) for i in range(len(t))]
a=' '.join(a)
print(a)
str = input()
str = list(str)


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

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

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

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

times = len(T)

list = []

for i in range(times):
    if T[i] == 'P' or T[i] == 'D':
        list.append(T[i])
    
    elif T[i] == '?':
        if i+1 >= len(T):
            list.append('D')
        elif T[i+1] == '?':
                list.append('P')
        elif T[i+1] == 'D':
                list.append('P')
        else:
            list.append('D')



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

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

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

for i in range(len(s)):
    print(s[i], end="")
print()
s=list(input()) 
for i in range(len(s)-1):
   if s[i] =="?":
      if s[i+1] =="D":
          s[i] ="P" 
      else:
        s[i] ="D" 
print(s)
T = input()
y = T.replace('P', 'D')
z = y.replace('?', 'D')
print(z)
T = input()
out = ""
i = 0
while(i < len(T)):
  if T[i] == "?":
    if i+1 < len(T):
      if T[i+1]=="D": 
        out += "P"
        i += 1
      elif T[i+1]=="P": 
        out += "D"
        i += 1
      elif T[i+1]=="?":
        out += "PD"
        i += 2
    else:
      out += "D"
      i += 1

  else:
    out += T[i]
    i += 1

print(out)
string = [c for c in input()]
for idx in range(len(string)-1, -1, -1):
    c = string[idx]
    if c == '?':
        if idx == len(string) - 1:
            string[idx] = 'D'
        elif string[idx+1] == 'P':
            string[idx] = 'D'
        else:
            string[idx] = 'P'
string = ''.join(string)
print(string)
t = input()
ans = [0]*(len(t))

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

print(*ans,sep="")
import math

s = list(input()[::-1])

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

print("".join(s[::-1]))
t = input()

prev = ""
res = []
for i, x in enumerate(t):
    if x == "?":
        if prev == "" or prev == "D" and (i < len(t) - 1 and t[i+1] != "P"):
            res.append("P")
        else:
            res.append("D")
    else:
        res.append(x)
    prev = res[-1]
print("".join(res))
t = list(input())

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

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


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

PDpoints = 0
num = []
i = 0
j = 1

while(j != len(input)):
    if j == len(input):
        break
    elif input[i] == '?':
        if input[j] == '?' or input[j] == 'D':
            input = input.replace(input[i], 'P')
        elif input[i-1] == 'P':
            input = input.replace(input[i], 'D')
        else:
            input = input.replace(input[i], 'D')
    i += 1
    j += 1
print(input)
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[len(t)-1] == "?":
    t[len(t)-1] = "D"

ans = ""

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

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

max = 0
tmp = 0

t = t.replace('?', 'D')
#print(t)

# how many D
tmp = t.count('D')

# how many PD
tmp += t.count('PD')

max = tmp

print(max)
t = list(input())
for i in range(1,len(t)):
    if t[i-1] == '?' and t[i] == 'D':
        t[i-1] = 'P'
    elif t[i-1] == 'P' and t[i] == '?':
        t[i] = 'D'
    elif t[i] == '?':
        t[i] = 'P'
ans = ''
for i in range(len(t)):
    ans+=t[i]
print(ans)
t = list(input())
t.reverse()

tmp = "A"
for i in range(len(t)):
    if t[i] != "?":
        tmp = t[i]
    else:
        if tmp == "D":
            t[i] = "P"
            tmp = "P"
        else:
            t[i] = "D"
            tmp = "D"

t.reverse()
t = "".join(t)
print(t)
T = input()
l = list(T)
l_replace = ["D" if i == "?" else i for i in l]
print(l_replace)
t = input()


ans = ''


indexList = list()
for i in range(len(t)):
    if t[i] == '?':
        ans += 'D'
    else:
        ans += t[i]


print(ans.count('D') + ans.count('PD'))
t=input()
s = list(t)

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


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

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

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


T = list(T)

a = len(T) - 1

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


T = ''.join(T)

print(T)
X= list(input())
#str_list = list(str)
if X[0]=="?":
    X[0]="D"
for i in range(1,len(X)-1):
    if X[i]=="?":
        if X[i+1]=="D":
            X[i]="P"
        else:
            X[i]="D"
if X[-1]=="?":
    X[-1]="D"
Y= "".join(X)
print(Y)
a = input()
for i in range(0, len(a)):
    if a[i]== "?":
        if a[i-1]== 'D':
            a = a.replace("?", "P")
        else:
            a = a.replace("?", "D")
print(a)
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[i], 'P')
        else:
            input = input.replace(input[i], 'D')
    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)
#!/usr/bin/env python3


def main():
    T = list(input())
    N = len(T)
    for i in range(N):
        if T[i] == '?':
            if i == N-1:
                T[i] = 'D'
            elif T[i+1] == 'P':
                T[i] = 'D'
            else:
                T[i] = 'P'
    U = ''.join(T)
    print(U)

if __name__ == "__main__":
    main()
T=list(input())
T.insert(0,'B')
for i in range(1,len(T)):
    if T[i]=='?':
        if T[i-1]=='P':
            T[i]='D'
        else:
            T[i]='P'
            
T.pop(0)            
print(''.join(T))
t = input()
u = t.replace('?', 'D')
u = list(u)
for i in range(len(u)-2, -1, -1):
  if u[i] == 'D' and u[i+1] == 'D' and t[i] == '?':
    u[i] = 'P'
print(''.join(u))
t = input()
l = len(t)
if t[-1] == "?":
    t = t[0:l-1]+"D"
for i in range(1, l):
    if t[-i-1] == "?":
        if t[-i] == "P":
            t = t[0:l-i-1]+"D"+t[l-i:l]
        else:
            t = t[0:l-i-1]+"P"+t[l-i:l]
print(t)
T=input()
T=[str(t) for t in T]
for a in range(len(T)):
    if T[a]=='?':
        if a-1>=0 and T[a-1]=='P':
            T[a]='D'
        elif a+1>len(T)-1:
            T[a]='D'
        else:
            T[a]='P'
print(''.join(T))
t = input()
s_list = list(t)
for i in range(len(s_list)):
    if s_list[i] == '?':
        if i % 2 == 0:
            s_list[i] = 'P'
        else:
            s_list[i] = 'D'

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

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

print(s)
s = input().split("PP")
L = len(s)
ans = 0
tmp = 0
for i in range(L):
  ans = max(ans,len(s[i]))
  tmp = i
print(s[i].replace("?","D"))
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':
    t[i] = 'P'
    
print(''.join(t))
s = list(input())

for i, code in enumerate(s):
    if code == '?' and s[i-1] =='P':
        s[i] = 'D'
    elif code == '?' and s[i-1] =='D':
        s[i] = 'P' 
    elif code =='?' and i == 0:
        s[i] = 'P'

ans = ''.join(s)
print(ans)
T=list(input());
print(T);
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[len(T)-1]=='?':
  T[len(T)-1]='D';
print(T);
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)-2, -1, -1):
    if T[i] == '?':        
        if T[i + 1] == 'P':
            T[i] = 'D'
        else:
            T[i] = 'P'
print(''.join(T))
T=input()
S=""
if T[0]=="?":
  S+="D"
else:
  S+=T[0]
for x in range(1,len(T)):
  if T[x]=="?":
    if T[x-1]=="D":
      S+="P"
    else:
      S+="D"
  else:
    S+=T[x]
print(S)
t=list(input())
ans=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[-1]=="?":
    t[-1]="D"
print(*t,sep="")
import numpy as np
t = input()
x = '?'
def func(i):
  if t[i]==x:
    t[i]=='D'
  return t[i]
a = [func(i) for i in range(len(t))]
print(a)
t = input()

t = t.replace('?', 'D')
print(t.count('PD') + t.count('D'))
t=list(input())
for i in range(1,len(t)):
    if t[i]=="?":
        t[i]="D"
print("".join(t))
T=list(input())
N=len(T)
i=0
while i<N-1:
    if T[i]=="D":
        i=i+1
    elif T[i]=="P":
        if T[i+1]=="?":
            T[i+1]="D"
        i=i+1
    else:
        if T[i+1]=="P":
            T[i]="D"
        else:
            T[i]="P"
        i=i+1
    #print(i,T)
    #input()
print("".join(T))
s = input()
ans = ""
b4 = ""
c = 1
for i in s:
  if(i=="?"):
    if(b4=="P" or b4=="?"):
      ans+="D"
      b4 = "D"
    else:
      ans+="P"
      b4 = "P"
  else:
    ans+=i
    b4 = i
print(ans)
s = list(str(input()))
for i in range(len(s)):
    if s[-i] == '?':
        if s[-(i + 1)] == 'D':
            s[-i] = 'P'
        else:
            s[-i] = 'D'
print(''.join(s))
s = str(input())
ans = s[0]
for i in range(len(s)-1):
    if s[i+1] != "?":
        ans += s[i+1]
    else:
        ans += "D"
print(ans)
T = list("X"+input())
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[1:]))
T=input()
lis=[T[i] for i in range(len(T))]
for i in range(len(T)):
	if lis[i]=="?":
		if lis[min(i+1,len(T)-1)]=="D":
			lis[i]="P"
		else:
			lis[i]="D"
k="".join(lis)
print(k)
t = list(input())

for i in range(1, len(t)):
    if t[i] == '?':
        if i == len(t)-1:
            t[i] = 'D'
        else:
            if t[i+1] == '?' or 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 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:
      t[i]='D'
print(''.join(t))
t = list(input())
print(t)
for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'
print("".join(t))
def main():
	s = str(input())
	s = list(s)

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

	print(''.join(map(str, s)))


if __name__ == '__main__':
	main()
s=input()
t=s
s_list=list(s)
for i in range(len(t)):
    if t[i]=='?':
        
        if t[i-1]=='D':
            if i==len(t):
                s_list[i]='D'
            else:
                s_list[i]='P'
          
        else:
            s_list[i]='D'
    
s_cha="".join(s_list)            
print(s_cha)
pd=list(input())
for i in range(len(pd)-1):
  if pd[i]=='P' and pd[i+1]=='?':
    pd[i+1]='D'
  if pd[i]=='D' and pd[i+1]=='?':
    pd[i+1]='D'
print(''.join(pd))
s=list(input())
for i in range(1,len(s)):
	if s[i]=='?':
		if s[i-1]=='P':
			s[i]='D'
		elif s[i-1]=='?':
			s[i]='D'
		else:
			s[i]='P'
if s[0]=='?' and len(s)>1:
	if s[1]=='D':
		s[0]='P'
	else:
		s[0]='D'
elif s[0]=='?' and len(s)==1:
	s[0]='D'
print(''.join(s))
import itertools
import decimal
import math
import collections
import sys
input = sys.stdin.readline

T=input()

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

print(T.count("D")+T.count("PD"))
import re


def solve(stri):
    point = 0
    # Dの数
    for a in stri:
        if a == "D":
            point += 1
    # PDの数
    searched_pd = re.findall("PD",stri)
    point += len(searched_pd)
    return point

T = input()
T2 = re.sub('\?','D',T)

print(solve(T2))
T = list(input())+["-1"]
ans = T.copy()
flag = False
for i in range(len(T)-1):
    if flag:
        flag = False
        continue
    s = T[i:i+2]
    if s == ["?","?"]:
        ans[i] = "P"
        ans[i+1] = "D"
        flag = True
    elif s == ["?","D"]:
        ans[i] = "P"
    elif s[0] == "?":
        ans[i] = "D"
print("".join(ans[:-1]))
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 rev == "P" and r_s[i] == "?":
        ans += "D"
    elif rev == "D" and r_s[i] == "?":
        ans += "P"
    else:
        ans += r_s[i]
    rev = ans[i]

print(ans[::-1])
T = input()

T = list(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] = 'P'
        

T = ''.join(T)

print(T)
t=input()
ans=""
ren=0
for i in range(len(t)-1):
	if t[i]=="?":
		ren+=1
		if t[i+1]=="D" or (t[i+1]=="?" and ren%2==1):
			ans+="P"
		else:
			ans+="D"
	else:
		ren=0
		ans+=t[i]
if t[-1]=="?":
	ans+="D"
else:
	ans+=t[-1]
print(ans)
t = input()
t = t.replace('?', 'D')
num = t.count('D') + t.count('PD')
print(num)
word = input()
start = 0
end = len(word)
while(True):
	i = word.find('?', start, end)
	if (i == -1):
		break
	elif ((i == (end-1)) or (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=str(input())
T2=list(T)
if T2[0]=="?":
    T2[0]="D"

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

for i in range(1,len(T2)-1):
    if T2[i]=="?":
        if T2[i-1]=="D":
            T2[i]="P"
    
        else:
            T2[i]="D"
ans="".join(T2)    
print(ans)
S = list(input())
for i in range(1,len(S)-1):
    if S[i] == "?":
        S[i] = "D"
print("".join(S))
t = list(input())

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

for i, s in enumerate(t):
    if s == '?' and temp == 'D':
        t[i] = 'P'
    elif s == '?' and temp == 'P':
        t[i] = 'D'
    elif s == '?' and i == 0:
        t[i] = 'D'
    temp = t[i]

print(*t, sep='')
t = list(input())
a = 0
b = 0

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

    if i == len(t) - 1 and t[i] == '?':
        t[i] = 'D'

print(''.join(t))
x = input()
s = ""
if x[0] == "?":
	s = s+ "P"
else:
	s = s + x[0]
for i in range(1,len(x)):
	if x[i] == "?":
		if s[-1] == "D":
			s = s + "P"
		else:
			s = s + "D"
		continue
	s = s + x[i]
print(s)
t = input()
ans = t
for i in range(len(t)):
    if t[i] == '?':
        if ans[i-1] == 'P':
            ans = ans[:i] + 'D' + ans[i+1:]
        else:
            ans = ans[:i] + 'P' + ans[i+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'
            t[i+1]='D'
        elif t[i+1]=='P':
            t[i]='D'
        elif t[i+1]=='D':
            t[i]='P'
print(''.join(t))
def main():
    t = list(input())
    lent = len(t)
    if t[-1] == '?':
        t[-1] = 'D'

    for i1 in range(lent - 2, -1, -1):
        if t[i1] == '?':
            if t[i1+1] == 'D':
                t[i1] = 'P'
            else:
                t[i1] = 'D'
    r = "".join(t)
    print(r)

if __name__ == '__main__':
    main()
a= input()
c=""
for i in range(1, len(a)):
    if a[i-1]=="?":
        c=c+"D"
    else:
        c=c+a[i-1]
print(c)
s=list(input()) 

for i in range(len(s)-1):

   if s[i] =="?":

      if s[i+1] =="D" or s[i-1] =="D":
          s[i] ="P" 
      else:

        s[i] ="D" 

print(s)
x = list(input().split())

 
l_replace = [s.replace('?', 'D') for s in x]
print(l_replace)
t = [i for i in input()]
t.reverse
# print(t)

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

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

t.reverse
o = ''.join(t)

print(o)
t = list(input())
print(t)
for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'
ans = str("".join(t))
print(ans)
import numpy as np
t = input()
def func(i):
  if t[i]=='?':
    return 'D'
  else:
    return t[i]
a = [func(i) for i in range(len(t))]
a=' '.join(a)
print(a)
s = input()
r_s = s[::-1]

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]

print(ans[::-1])