Problem:
 Score : 200 points    Problem Statement For a string S consisting of the uppercase English letters P and D , let the doctoral and postdoctoral quotient of S be the total number of occurrences of D and PD in S as contiguous substrings. For example, if S =  PPDDP , it contains two occurrences of D and one occurrence of PD as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3 .  We have a string T consisting of P , D , and ? .  Among the strings that can be obtained by replacing each ? in T with P or D , find one with the maximum possible doctoral and postdoctoral quotient.      Constraints  1 \leq |T| \leq 2 \times 10^5  T consists of P , D , and ? .         Input Input is given from Standard Input in the following format:  T       Output Print one string with the maximum possible doctoral and postdoctoral quotient among the strings that can be obtained by replacing each ? in T with P or D .
If there are multiple such strings, you may print any of them.        Sample Input 1 PD?D??P      Sample Output 1 PDPDPDP  This string contains three occurrences of D and three occurrences of PD as contiguous substrings, so its doctoral and postdoctoral quotient is 6 , which is the maximum doctoral and postdoctoral quotient of a string obtained by replacing each ? in T with P or D .       Sample Input 2 P?P?      Sample Output 2 PDPD

Solution (Python):
T = list(map(str, input()))
count = 0
ans = []




for i in range(0, len(T)):
    if T[i] == '?':
        ans.append('D')
    else:
        ans.append(T[i])


ans_ans = ''.join(ans);

print(ans_ans)

Solution (Python):
import sys
from io import StringIO
import unittest

def resolve():
    t = input()

    len_t = len(t)

    ans = []
    set_p = False
    
    for i in range(len_t):
        if t[i] is "?":
            if i is 0:
                ans.append("D")
            elif len_t-1 is i:
                ans.append("D")
            elif ans[i-1] is "P":
                ans.append("D")
            elif t[i+1] is "D" or t[i+1] is "?":
                ans.append("P")
            else:
                ans.append("D")
        else:
            ans.append(t[i])

    print("".join(ans))




class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """PD?D??P"""
        output = """PDPDPDP"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """P?P?"""
        output = """PDPD"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """?????"""
        output = """DPDPD"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """?DDD??"""
        output = """DDDDPD"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """?DPP??P??"""
        output = """DDPPDDPDD"""
        self.assertIO(input, output)

    def test_入力例_6(self):
        input = """??????D?"""
        output = """DPDPDPDD"""
        self.assertIO(input, output)

    def test_入力例_7(self):
        input = """???????"""
        output = """DPDPDPD"""
        self.assertIO(input, output)

    def test_入力例_8(self):
        input = """??P?PP??"""
        output = """DDPDPPDD"""
        self.assertIO(input, output)

    def test_入力例_9(self):
        input = """??P?D?PP?D"""
        output = """DPDPDPDD"""
        self.assertIO(input, output)


if __name__ == "__main__":
    
    resolve()

Solution (Python):
print(input().replace('?', 'D'))

Solution (Python):
T=input()

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

Solution (Python):
t = input()
le = len(t)
tt = []
for i in range(le):
    c = t[i]
    if t[i] == '?':
        c = 'D'
        if i > 0 and tt[i - 1] == 'P':
            c = 'D'
        elif i == 0 and le > 1 and t[i + 1] == 'D' or i == 0 and le > 1 and t[i + 1] == '?':
            c = 'P'
        elif i < le - 1 and t[i + 1] == 'D' or i < le - 1 and t[i + 1] == '?':
            c = 'P'
    tt.append(c)
print(''.join(tt))

Solution (Python):
t=input()

tla=list(t)
tlb=list(t)
pd1=0
pd2=0

for i in range(len(tla)):
  if tla[i]=="?":
    if i==0:
      pass
    elif i==len(tla)-1:
      tla[i]="D"
    elif tla[i-1]=="P":
      tla[i]="D"
    elif tla[i+1]=="D":
      tla[i]="P"
    elif tla[i+1]=="?":
      tla[i]="P"
    else:
      tla[i]="D"
  if tla[i]=="D":
    if i==0:
      pass
    elif tla[i-1]=="P":
      pd1+=1
d1=tla.count('D')
s1=d1+pd1

for i in range(len(tlb)):
  if tlb[i]=="?":
    tlb[i]="D"
  if tlb[i]=="D":
    if i==0:
      pass
    elif tlb[i-1]=="P":
      pd2+=1
d2=tlb.count('D')
s2=d2+pd2

if s1>=s2:
  print(''.join(tla))
else:
  print(''.join(tlb))

Solution (Python):
t = input()
ans = []
for i in t:
    if i == "?":
        i = "D"
    ans.append(i)

print("".join(ans))

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

Solution (Python):
t = input('')

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

print("".join(tlist))

Solution (Python):
t=input()
n=len(t)
a=[0]*n
for i in range(n):
    a[i]=t[i]

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

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

Solution (Python):

t =  str(input())
s = ''
for i in t:
    if i == '?':
        
        
        s += 'D'
    else:
        s += i
print(s)

Solution (Python):
T = input()
print(T.replace("?", "D"))

Solution (Python):
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)
	else:
		word = word.replace('?', "D", 1)
	start = i + 1
print(word)

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

Solution (Python):
S = input()
 
print(S.replace('?', 'D'))

Solution (Python):
T = input()
print(T.replace("?", "D"))

Solution (Python):
print(input().replace('?', 'D'))

Solution (Python):
s = str(input())
s_ = list(s)
for i in range(len(s)):
  if s_[i]=='?':
    s_[i]='D'
S = "".join(s_)
print(S)

Solution (Python):
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" and T2[i+1]!="P":
            T2[i]="P"
            
        else:
            T2[i]="D"
ans="".join(T2)    
print(ans)

Solution (Python):
list=input()
newlist=[list[i:i+1] for i in range(0,len(list))]
for n in range(0,len(newlist)):
 if newlist[n]=="?":
  newlist[n]="D"
print(''.join(newlist))

Solution (Python):
t = list(map(str,input()))
tmpP = 0
cnt = 0
l = len(t)

for i in t:
    cnt += 1
    if i == "?":
      t[cnt-1] = "D"
            
print("".join(t))

Solution (Python):
n=input()
m=len(n)
li=[]
for i in range(m):
  li.append(n[i])

for i in range(len(li)):
  if li[i]=="?":
    li[i]="D"
  else:
    pass

print("".join(li))

Solution (Python):
T=input()
print(T.replace('?', 'D'))

Solution (Python):
S = input()
 
print(S.replace('?', 'D'))

Solution (Python):
s = list(input())
for index, i in enumerate(s):
  if i == "?":
    s[index] = "D"
ans = "".join(s)
print(ans)

Solution (Python):
li=list(input())
lis=li.copy()
count1=0
count2=0
for i in range(0,len(li)):
  if li[i]=='P':
      try:
        if li[i+1]!='P':
          count1+=1
          li[i+1]='D'
      except IndexError:
          continue
  elif li[i]=='?':
      li[i]='P'
  else:
      continue
    
for i in range(0,len(lis)):
  if lis[i]=='P':
      try:
        if lis[i+1]!='P':
          count2+=1
          lis[i+1]='D'
      except IndexError:
          continue
  elif lis[i]=='?':
      lis[i]='D'
    
    
  else:
      continue


c=li.count('D')
d=lis.count('D')
a=c+count1
b=d+count2
if a>=b:
  for i in li:
    print(i,end='')
else:
  for i in lis:
      print(i,end='')

Solution (Python):
import numpy as np
T=[]
T=list(input())
values = np.array(T)
searchval = '?'
ii = np.where(values == searchval)[0]

if len(ii)>0:
    for k in ii:
        if k==0:
            if len(T)>1:
                if T[k+1]=='D':
                    T[k]='P'
                else:
                    T[k]='D'
            else:
                T[k] = 'D'

        else:
            if T[k-1] == 'P':
                T[k] = 'D'
            else:
                if k+1<len(T):
                    if T[k+1] == 'D':
                        T[k] = 'P'
                    else:
                        T[k]='D'
                else:
                    T[k] = 'D'

newT=''.join(map(str,T))
print(newT)

Solution (Python):
S= input()
DP = [[0,0] for i in range(len(S)+1)]
tr = [[-1,-1] for i in range(len(S)+1)]
for i in range(1,len(S)+1):
  ch = S[i-1]
  
  if ch == "D":
    DP[i][0] = max(
      DP[i-1][0]+1,
      DP[i-1][1]+2)
    if DP[i][0] == DP[i-1][0]+1:
      tr[i][0] = 0
    else:
      tr[i][0] = 1
    tr[i][1] = -1
    DP[i][1] = 0
    
  elif ch == "P":
    DP[i][0] = 0
    DP[i][1] = max(
      DP[i-1][0],
      DP[i-1][1])
    
    if DP[i][1] == DP[i-1][0]:
      tr[i][1] =0
    else:
      tr[i][1] = 1
    tr[i][0] = -1
    
  else:
    DP[i][0] = max(
      DP[i-1][0]+1,
      DP[i-1][1]+2)
    
    if DP[i][0] == DP[i-1][0]+1:
      tr[i][0] = 0
    else:
      tr[i][0] = 1
      
    DP[i][1] = max(
      DP[i-1][0],
      DP[i-1][1])
    if DP[i][1] == DP[i-1][0]:
      tr[i][1] = 0
    else:
      tr[i][1] = 1
      

if max(DP[i]) == DP[i][0]:
  pointer = 0
else:
  pointer = 1
ans = ""
for i in range(len(S)):
  ans += ["D","P"][pointer]
  pointer = tr[-i-1][pointer]
print("".join(reversed(ans)))

Solution (Python):
t=list(input())
for i in range(len(t)):
  if t[i]=='?':
    t[i]="D"
print("".join(t))

Solution (Python):
t=list(input())
for i in range(len(t)):
    if t[i]=='?':
        t[i]='D'
print(''.join(t))

Solution (Python):
t=input()
t=t.replace("?", "D")
print(t)

Solution (Python):
t=input()
prevc = t[0]
if t[0]!='?':
  newt=t[0]
else:
  newt="D"
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)

Solution (Python):
if __name__ == "__main__":
    T = input()
    ans = T
    ans = ans.replace("P?", 'PD')
    ans = ans.replace("??", 'PD')
    ans = ans.replace("?D", 'PD')
    ans = ans.replace("?", 'D')
    print(ans)

Solution (Python):
print(input().replace('?','D'))

Solution (Python):
a=input()
b=a.replace("?","D")
print(b)

Solution (Python):
print(input().replace('?','D'))

Solution (Python):
T = list(input())

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

print("".join(T))

Solution (Python):
list=input()
newlist=[list[i:i+1] for i in range(0,len(list))]
for n in range(0,len(newlist)):
 if newlist[n]=="?":
  newlist[n]="D"
print(''.join(newlist))

Solution (Python):
A=input()
for i in(A):
  if i=="?":
    print("D",end="")
  else:
    print(i,end="")

Solution (Python):
T = input()
S = T.replace("?", "D")
print(S)

Solution (Python):
pd = list(input())


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


for s in pd:
  print(s, end=(""))

Solution (Python):

S = str(input());l = len(S);Str = ""
for num in range(l):
    if S[num] != "?":
        Str += S[num]
    else:
        Str += "D"
print(Str)

Solution (Python):
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

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

print(T)

Solution (Python):
T=input()
G=T.replace('?','D')
ans=G.count('D')

print(G)

Solution (Python):
S = list(input())

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

print("".join(S))

Solution (Python):
T = str(input())

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

print(ans)

Solution (Python):
s = input().replace('?', 'D')

print(s)

Solution (Python):
T = input()

T_list = list(T)

if T_list[0] == '?':
    T_list[0] = 'D'
    
for i in range(len(T)-1):
    if T_list[i] == 'P' and T_list[i+1] == '?':
        T_list[i+1] = 'D' 
    elif T_list[i] == '?' and T_list[i+1] == '?':
        T_list[i] = 'P'
        T_list[i+1] = 'D'
    elif T_list[i] == '?' and T_list[i+1] != '?':
        T_list[i] = 'D'
    else:
        continue

if T_list[-1] == '?':
    T_list[-1] = 'D'
    
S = "".join(T_list)
 
print(S)

Solution (Python):
T = input()

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

Solution (Python):
a = input()

print(a.replace('P?', 'PD').replace('?D', 'PD').replace('??', 'PD').replace('?', 'D'))

Solution (Python):

t=list(input())
t = ''.join(t)
t=t.replace("?", "D")
print(t)

Solution (Python):
import sys
input = sys.stdin.readline

t = input()

t_update = ""
for i in t:
    if i == "?":
        i = "D"
    t_update += i
print(t_update)

Solution (Python):
t=input()

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

t=new
new=""

for i in reversed(range(len(t))):
    if t[i] != "?":
        new=t[i]+new
    else:
        if new=="":
            new=t[i]+new
        elif new[0]=="D":
            new="P"+new
        else:
            new=t[i]+new

t=new
new=""

for i in range(len(t)):
    if t[i] != "?":
        new+=t[i]
    else:
        new+="D"


print(new)

Solution (Python):
base_txt = input()
base_txt_to_P = base_txt.replace("?","P")
base_txt_to_D = base_txt.replace("?","D")
index_count_base_txt_to_P = base_txt_to_P.count("D") + base_txt_to_P.count("PD")
index_count_base_txt_to_D = base_txt_to_D.count("D") + base_txt_to_D.count("PD")
if index_count_base_txt_to_P >index_count_base_txt_to_D:
    print(base_txt_to_P)
else:
    print(base_txt_to_D)

Solution (Python):
T = input()
N = len(T)
after_T = ''

for i in range(N):
    charr=T[i]
    if(charr=='?'):
        after_T+='D'
    else:
        after_T+=charr

print(after_T)

Solution (Python):
t = list(input())
tl = len(t)

for i in range(tl):
    if t[i] != '?':
        continue

    if tl == 1:
        t[i] = 'D'
    elif i == tl - 1:
        t[i] = 'D'
    elif t[i-1] == 'P':
        t[i] = 'D'
    elif t[i+1] == '?':
        t[i] = 'P'
    elif t[i+1] == 'D':
        t[i] = 'P'
    else:
        t[i] = 'D'

print(''.join(t))

Solution (Python):
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':
      if s_list[i-1]=='P':
        s_list[i]='D'
      else:
        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)

Solution (Python):
s = list(input())
if len(s) < 2:
    print("D")
    exit()
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="D"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="D"
                    else:
                        s[i]= "D"
print(''.join(s))

Solution (Python):
T_list = input()
T = list(T_list)
nT = [0]*len(T)
if T[len(T)-1] == '?':
    T[len(T)-1] = 'D'
for i in range(len(T)):
    if T[i] != '?':
        nT[i] = T[i]
    else:
        if 0<i and i<len(T)-1:
            if T[i-1] == 'P':
                nT[i] = 'D'
                T[i] = 'D'
            elif T[i+1] == 'D':
                nT[i] = 'P'
                T[i] = 'P'
            elif T[i+1] == '?':
                nT[i] = 'P'
                T[i] = 'P'
            else:
                nT[i] = 'D'
                T[i] = 'D'
        else:
            if i<len(T)-1:
                if T[i+1] == 'D':
                    nT[i] = 'P'
                    T[i] = 'P'
                elif T[i+1] == '?':
                    nT[i] = 'P'
                    T[i] = 'P'
                else:
                    nT[i] = 'D'
                    T[i] = 'D'
nT=''.join(nT)              
print(nT)

Solution (Python):
T = input()
T_list = list(T)
i = 0
for s in T_list:
  if i == len(T_list):
    break
  if i == 0:
    if T_list[i] == "?":
      if 1 < len(T_list):
        if T_list[i+1] == "D":
          T_list[i] = "P"
        elif T_list[i+1] == "?":
          T_list[i] = "P"
          T_list[i+1] = "D"
          i = i + 2
          continue
        else:
          T_list[i] = "D"
      else:
        T_list[i] = "D"
  else:
    if T_list[i] == "?":
      if T_list[i-1] == "P":
        T_list[i] = "D"
      elif i+1 < len(T_list):
        if T_list[i+1] == "D":
          T_list[i] = "P"
        elif T_list[i+1] == "?":
          T_list[i] = "P"
          T_list[i+1] = "D"
          i = i + 2
          continue
        else:
          T_list[i] = "D"
      else:
        T_list[i] = "D"
  i = i + 1
T = "".join(T_list)
print(T)

Solution (Python):
s = input()
t = s.replace('P?', 'PD')
u = t.replace('?D', 'PD')
v = u.replace('??', 'PD')
w = v.replace('?', 'D')
print(w)

Solution (Python):
T = input()
T_l = [t for t in T]

for i in range(len(T_l)):
  if T[i] =="?": T_l[i] = "D"

print("".join(T_l))

Solution (Python):
def resolve():
    t = input()
    s = ""
    for c in t:
        if c == "?":
            c = "D"

        s += c
    print(s)

resolve()

Solution (Python):
T=input()
T=T.replace("?","D")
print(T)

Solution (Python):
s = input()
 
for i in range(len(s)):
    if s[i] == '?':
        if i == 0 and len(s) == 1:
            s = s.replace('?','D',1)
        elif i == 0 and s[1] == 'D':
            s = s.replace('?','P',1)
        elif i == 0 and s[1] == 'P':
            s = s.replace('?','D',1)
        elif i == 0 and s[1] == '?':
            s = s.replace('?','D',1)
        elif s[i-1] =='P':
            s = s.replace('?','D',1)
        elif s[i-1] =='D' and (i ==len(s)-1):
            s = s.replace('?','D',1)
        elif s[i-1] =='D' and (i <len(s)-1 and(s[i+1] == 'P' or s[i+1] == '?')):
            s = s.replace('?','D',1)
        else:
            s = s.replace('?','P',1)


print(s)

Solution (Python):
T = [s for s in input().strip()]

total_sum = 0
pre = T[0]
if pre == "D":
    total_sum = 1
elif pre == "?":
    total_sum = 1
    T[0] = "D"
    pre = "D"

for i in range(1, len(T)):
    now = T[i]
    if now == "D" and pre == "P":
        total_sum += 2
        pre = "D"
    elif now == "D" and pre == "D":
        total_sum += 1
        pre = "D"
    elif now == "?" and pre == "D":
        total_sum += 1
        pre = "D"
        T[i] = "D"
    elif now == "?" and pre == "P":
        total_sum += 2
        pre = "D"
        T[i] = "D"
    else:
        pre = now

print("".join(T))

Solution (Python):
t=input()

def score(t):
  count=0
  for i in range(len(t)-1):
    if t[i]=='D':
      count+=1
    if t[i]=='P'and t[i+1]=='D':
      count+=1
  return count

hold=0

t_tr=t.replace('?','D')




print(t_tr)

Solution (Python):
T = input()
_T = T.replace('?','D')
print(_T)

Solution (Python):
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

import sys
sys.setrecursionlimit(4100000)
rl = sys.stdin.readline

T = list(input())

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

Solution (Python):
t = input()
n = len(t)
s_list = list(t)
for i in range(len(s_list)-1):
    if s_list[i] == '?':
        if s_list[i+1] == 'D' and s_list[i-1] == 'D':
            s_list[i] = 'P'
        elif s_list[i+1] == 'D' and s_list[i-1] == 'P':
            s_list[i] = 'D'
        elif s_list[i+1] == 'P' and s_list[i-1] == 'P':
            s_list[i] = 'D'
        elif s_list[i+1] == '?' and s_list[i-1] == 'D':
            s_list[i] = 'P'
        elif s_list[i+1] == '?' and s_list[i-1] == 'P':
            s_list[i] = 'D'
        else:
            s_list[i] = 'D'
if s_list[-1] == "?":
    s_list[-1] = 'D'


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

Solution (Python):
t = input()
t = list(t)

for i in range(len(t)):
    if t[i] == "?":
        t[i] = 'D'
ans = "".join(t)
print(ans)

Solution (Python):
def main():
    T = input()
    
    T = T.replace('?', 'D')

    

    
    
            
    
    print(T)
main()

Solution (Python):
s = input()
s = list(str(s))

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

print(''.join(s))

Solution (Python):
T=list(input())

for idx in range(len(T)):
	if T[idx]=='?': 
		T[idx]='D'
print(''.join(T))

Solution (Python):
import math

def a():
    h1, m1, h2, m2, k = map(int, input().split())
    t1 = h1 * 60 + m1
    t2 = h2 * 60 + m2

    if t1 < t2:
        print(t2 - t1 - k)
    else:
        print(1440 - (t1 - t2) - k)


def b():
    t = input()
    print(t.replace('?','D'))
            



def c():
    print('')



def d():
    print('')


b()

Solution (Python):
t = input()
n = len(t)
t += "a"
ans = ""
for i in range(n):
    if t[i] == "?":
        ans += "D"
    else:
        ans += t[i]
print(ans)

Solution (Python):
S = input()
length =len(S)
S = list(S)
count = 0

for i in range(length):
  if S[i] == '?':
    S[i] = 'D'

answer = "".join(S)
print(answer)

Solution (Python):
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 list:
    tt[i]="D"
answer=""
for p in range(len(T)):
    answer+=tt[p]
print(answer)

Solution (Python):




def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    

    
    

    t = input().rstrip()
    res = []
    for i in range(len(t)):
        if t[i] != '?':
            res.append(t[i])
        else:
            res.append('D')
    print(''.join(res))

if __name__ == '__main__':
    main()

Solution (Python):
T = str(input())
T=list(T)
if not T[0]=='?':
    for i in range(1,len(T)-1):
        if T[i]=='?':
            if T[i-1]=='D' and T[i+1]=='D':
                T[i]='P'
            else:
                T[i]='D'
    if T[len(T)-1]=='?':
        T[len(T)-1]='D'
else:
    T[0]='D'
    for i in range(1,len(T)-1):
        if T[i]=='?':
            if T[i-1]=='D' and T[i+1]=='D':
                T[i]='P'
            else:
                T[i]='D'
    if T[len(T)-1]=='?':
        T[len(T)-1]='D'

print(''.join(T))

Solution (Python):
t=str(input())
print(t.replace("?","D"))

Solution (Python):
T = input()

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

Solution (Python):
t = list(input())
l = len(t)

for i in range(l):
    if t[i] == "?":
        t[i] = "D"
        print(t[i],end="")
    else:
        print(t[i],end="")

Solution (Python):


def main():
    t = input()
    t_list = ['D']
    cnt = 0
    for s in t:
        if s == '?':
            cnt += 1
        else:
            if cnt > 0:
                t_list.append(cnt)
            cnt = 0
            t_list.append(s)
    if cnt > 0:
        t_list.append(cnt)
    t_list.append('P')

    for i in range(len(t_list)):
        if isinstance(t_list[i], int):
            k = t_list[i] // 2
            if t_list[i] % 2 == 0:
                if t_list[i-1] == 'P':
                    t_list[i] = 'D' + 'PD' * (k-1)
                    if t_list[i+1] == 'P':
                        t_list[i] += 'D'
                    else:
                        t_list[i] += 'P'
                else:
                    t_list[i] = 'PD' * k
            else:
                if t_list[i-1] == 'P':
                    t_list[i] = 'D' + 'PD' * k
                else:
                    t_list[i] = 'PD' * k
                    if t_list[i+1] == 'P':
                        t_list[i] += 'D'
                    else:
                        t_list[i] += 'P'

    print(''.join(t_list[1:-1]))

if __name__ == '__main__':
    main()

Solution (Python):
t = input()

ans = t
tem = ''
if '?' in t :  
    if len(t) == 1 :
        ans = 'D'
    elif len(t) == 2 :
        if t[0] == '?' and t[1] == '?' :
            ans = 'PD'
        elif t[0] == '?' and t[1] == 'D':
            ans = 'PD'
        elif t[0] == '?' and t[1] == 'P':
            ans ='DP'
        elif t[1] == '?' and t[0] == 'P':
            ans = 'PD'
        elif t[1] == '?' and t[0] == 'D':
            ans = 'DD'
    else:
        for i in range(0,len(t)):
            if i == 0 :
                if t[i] == '?' and t[i+1] == 'P':
                    ans = 'D'
                elif t[i] == '?' :
                    ans = 'P'
                else :
                    ans = t[i] 
                    
            elif i == len(t)-1 :
                if t[i] == '?' :
                    ans += 'D'
                else:
                    ans += t[i]
            else:
                if t[i] == '?':
                    if ans[i-1] == 'P':
                        ans += 'D'
                    elif t[i+1] == 'D' or t[i+1] == '?':
                        ans += 'P'
                    else:
                        ans += 'D'
                else:
                    ans += t[i]
print(ans)

Solution (Python):
T = input()
T_list = list(T)
i = 0
while i < len(T):
    if T_list[i] == "?":
        T_list[i] = "D"
    i += 1
T_new = "".join(T_list)
print(T_new)

Solution (Python):
s = input().replace('?', 'D')
print(s)

Solution (Python):
data = input()
data_rep = data.replace("?","D")
print(data_rep)

Solution (Python):
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  
def LS2(): return list(sys.stdin.readline().rstrip())  

T = LS2()

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

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

print(ans)

Solution (Python):
T = list(input())
for i in range(len(T)):
    if T[i] == '?':
        T[i] = 'D'

print(''.join(T))

Solution (Python):
S = list(input())

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

S = "".join(S)
print(S)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
t=input()
tl=list(t)
tln=len(t)
x=0
for x in range(tln):
    if tl[x] == "?":
        if x == tln-1:
            tl[x]="D"
            break
        elif x==0:
            if tl[x+1]=="?":
                tl[x]="P"
                tl[x+1]="D"
            else:
                tl[x]="D"
        elif tl[x-1]=="P":
            tl[x]="D"
        elif tl[x+1]=="?":
            tl[x]="P"
            tl[x+1]="D"
        elif tl[x+1]=="D":
            tl[x]="P"
        else:
            tl[x]="D"
t="".join(tl)
print(t)

Solution (Python):
s = list(input())
t = len(s)
if t==1 and s[0]=="?":
    s[0]="D"    
for i in range(t-1):
    if i==0 and s[i]=="?":
        s[i]="D"
        if s[i+1]=="?":
            s[i+1]="D"
    elif s[-1]=="?" and s[-2]=="D" and i==t-2:
        s[-1]="D"
    elif s[i]=="D" and s[i+1]=="?" and s[i+2]=="P":
        s[i+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))

Solution (Python):
a = input()
t = list(a)
if t[len(t)-1] == "?":
    t[len(t)-1] = "D"
if t[0] == "?":
    if t[1] == "D" or t[1] == "?":
        t[0] = "P"
    else:
        t[0] = "D"
for i in range(1, len(t)-1):
    if t[i] == "?" and t[i-1] == "P":
        t[i] = "D"
    elif t[i] == "?" and t[i+1] == "D":
        t[i] = "P"
    elif t[i] == "?" and t[i+1] == "?":
        t[i] = "P"
    elif t[i] == "?":
        t[i] = "D"

answer = "".join(t)
print(answer)

Solution (Python):
T = input()
print(T.replace('?', 'D'))

Solution (Python):
import re
T = input()
t = re.sub("\?", "D", T)
print(t)

Solution (Python):
s = input()
pd = s.replace("?", "D")
print(pd)

Solution (Python):
T = input()
hatena_count = T.count("?")

pattern = ""
for i in range(hatena_count):
    pattern += "D"

max_exponent = T
for i in range(hatena_count):
    max_exponent = max_exponent.replace("?", pattern[i], 1)

print(max_exponent)

Solution (Python):
t = list(input())
t.reverse()

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

t.reverse()

if len(t) > 1:
    if t[0] == "?" and t[1] == "D":
        t[0] = "P"
    elif t[0] == "?" and t[1] == "P":
        t[0] = "D"

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

t = "".join(t)
print(t)

Solution (Python):
t = str(input())
ans  = t.replace("?","D")
print(ans)

Solution (Python):
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 != 0 and str[index - 1] == 'P'):
        str[index] = 'D'

    elif (value == '?' and str[index + 1] == '?'):
        str[index] = 'P'
        str[index + 1] = 'D'
    elif (value == '?'):
    	str[index] = 'D'


print(''.join(str))