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):
import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") 

s = input()













    








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

Solution (Python):
T = input()
T = T.replace("?","D")
ans = T.count("PD") + T.count("D")
print(T)

Solution (Python):

s = input()
prev = 'D'
ans = []

for i in s:
    if(i=='P' or i=='D'):
        prev=i
        ans.append(i)
    else:
        ans.append('D')

print(''.join(ans))

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

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

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

strS = "".join(S)

print(strS)

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

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

Solution (Python):
def main():
    s = list(input())

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

    print(*s, sep="")


if __name__ == "__main__":
    main()

Solution (Python):
inf = float("inf")

S = input()



N = len(S)
bestP = [None for i in range(N)]
bestD = [None for i in range(N)]
if S[0] in ["?", "D"]:
    bestP[0] = 0
    bestD[0] = 1
else:
    bestP[0] = 0
    bestD[0] = 0
for i in range(1, N):
    bestP[i] = max(bestD[i - 1], bestP[i - 1])
    bestD[i] = max(bestD[i - 1] + 1, bestP[i - 1] + 2)
    if S[i] != "?":
        if S[i] == "P":
            bestD[i] = -inf
        else:
            assert S[i] == "D"
            bestP[i] = -inf

ans = [None for i in range(N)]
if bestP[-1] > bestD[-1]:
    ans[-1] = 'P'
else:
    ans[-1] = 'D'
for i in range(N - 2, -1, -1):
    if S[i] != '?':
        ans[i] = S[i]
    else:
        prev = ans[i + 1]
        if prev == 'D':
            if bestP[i] + 2 > bestD[i] + 1:
                ans[i] = 'P'
            else:
                ans[i] = 'D'
        else:
            if bestP[i] > bestD[i]:
                ans[i] = 'P'
            else:
                ans[i] = 'D'

print(''.join(ans))

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

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

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

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

Solution (Python):
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"
        if s[1] == "?":
            if s[0] == "P":
                T[i+1] = "D"
            elif i == len(T)-2:
                T[i+1] == "D"
print("".join(T[:-1]))

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

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

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

if t[0]=="?":
    if len(t)<=2:
        t[0]="D"

    elif t[1]=="P":
        t[0]="D"
    
    else:
        t[0]="P"
for i in range(1,len(t)):
    if t[i]=="?":
        if i+1==len(t):
            t[i]="D"
            break
        if t[i-1]=="P":
            t[i]="D"
        else:
            if t[i+1]=="P":
                t[i]="D"
            else:
                t[i]="P"
b=""
for i in range(len(t)):
    b+=t[i]
print(b)

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

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

Solution (Python):
def main():
    T = input()
    ans = ""
    for i in range(len(T)):
        t = T[i]
        if t=='P' or t=='D':
            ans += t
        else:
            ans += 'D'
    print(ans)
main()

Solution (Python):
t=input()
result=''
for i in range(len(t)-1):
    if t[i]=='?':
        try:
            if result[i-1]=='P':
                result+='D'
            else:
                if t[i+1]=='P':
                    result+='D'
                else:
                    result+='P'
        except:
            if t[i+1]=='P':
                result+='D'
            else:
                result+='P'
    else:
        result+=t[i]
if t[len(t)-1]=='?' or  t[len(t)-1]=='D':
    print(result+'D')
else:
    print(result+'P')

Solution (Python):
def main():
    t = input()
    ans = ''
    for c in t:
        if c == '?':
            ans += 'D'
        else:
            ans += c
    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):
t = input()

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

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

Solution (Python):


import sys

def main():
    strings = input()
    replace_string=strings.replace('?','D')
    print(replace_string)

if __name__ == "__main__":
    main()

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

for i, s in enumerate(t):
    if s == '?':
        t[i] = 'D'

print(*t, sep='')

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

if len(T) == 1:
    print('D')
    exit()

if T[0] == '?':
    if T[1] == 'P':
        T[0] = 'D'
    else:
        T[0] = 'P'


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

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

print(''.join(T))

Solution (Python):
T = input()
now = 0
ans = ""
K = T.replace("?","D")
print(K)

Solution (Python):
T = list(input())
N = len(T)
if T[-1] == "?":
    T[-1] = "D"

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

ans = "".join(T)         
print(ans)

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

Solution (Python):
T=str(input())
n=len(T)
ans=''

for i in range(n):
    if T[i]=='?':
        ans+='D'
    else:
        ans+=T[i]

    

print(ans)

Solution (Python):
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:
            if ket[now-1]=="P":
                ket[now]="D"
            else:
                ket[now]="P"
    now=now-1
if ket[0]=="?"and len(t)>1:
    if ket[1]=="P":
        ket[0]="D"
    else:
        ket[0]="P"

print(*ket,sep="")

Solution (Python):
T = input()



ans = ''
n = 0

T2 = T.replace('?', 'D')
d = T2.count('D')
pd = T2.count('PD')
if n < d+pd:
    n = d+pd
    ans = T2

T2 = T.replace('?D', 'PD')
T2 = T2.replace('?', 'D')
d = T2.count('D')
pd = T2.count('PD')
if n < d+pd:
    n = d+pd
    ans = T2

print(ans)

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

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

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

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

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

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

print(''.join(t))

Solution (Python):
lists = list(input())
leng = len(lists)
count = 0
flag = 0
for i in lists:
	if lists[count] == "?":
		if count + 1  < leng:
			if flag == 0:
				if (lists[count+1] == "D" or lists[count+1] == "?"):
					lists[count] = "P"
					flag = 1
				else:
					lists[count] = "D"
					flag = 0
			else:
				lists[count] = "D"
				flag = 0
		else:
			lists[count] = "D"
	else:
		flag = 1
	count = count + 1
print("".join(lists))

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

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

print(D)

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

for i in range(len(s)):
  if s[i] == "?":
    s[i] = "D"
    
for i in range(len(s)):
  print(s[i], end="")

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

t=input()

a=[]
j=0
for i in range(len(t)):
    if t[i]=="?":
        a.append("D")
    else:
        a.append(t[i])

print("".join(a))

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

Solution (Python):


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

Solution (Python):
T = list(input()) 
ans = []
for i in T:
    if i == "?":
        ans.append("D")
    else:
        ans.append(i)
print("".join(ans))

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

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

print(a)

Solution (Python):
t = input()
if t == 'P':
    print('P')
elif t == 'D' or t == '?':
    print('D')
else:
    t = list(t)
    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] == '?':
            if t[i-1] == 'P':
                t[i] = 'D'
            else:
                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))

Solution (Python):
s=input()
l=[i for i in s]
for i in range(len(s)):
	if(s[i]=='?'):
		l[i]='D'
for i in l:
	print(i,end="")
print()

Solution (Python):
t = list(input())
"""
flag = [False]*len(t)

for i in range(len(t)):
    if t[i] == 'P':
        flag[i] = True
"""

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

print("".join(t))

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

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

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

t = ''.join(t)




print(t)

Solution (Python):
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 X[i]!='?': continue
    if i==0:
      if X[1]=='P': X[0]='D'
      else:X[0]='P'
    else:
      if X[i-1]=='P' or X[i+1]=='P':X[i]='D'
      else:X[i]='P'
  if X[-1]=='?':X[-1]='D'
  print("".join(X))

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













s_list = list(s)


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

str_change = "".join(s_list)





print(str_change)

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

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

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

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))

Solution (Python):
T = input()


T = list(T)


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


T = ''.join(T)

print(T)

Solution (Python):


word = input()
for i in word:
    if i == '?':
        print('D',end='')
    else:
        print(i,end='')

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

Solution (Python):
t=list(input())
if t[-1]=='?':
    t[-1]='D'
indexes = [i for i, x in enumerate(t) if x == '?']
for i in range(len(indexes)-1,0,-1):
    a=indexes[i]
    if t[a-1]=='P':
        t[a]='D'
    else:
        if t[a+1]=='D':
            t[a]='P'
        else:
            t[a]='D'
if '?'in t:
    a=t.index('?')
    if t[a-1]=='P':
        t[a]='D'
    else:
        if t[a+1]=='D':
            t[a]='P'
        else:
            t[a]='D'   
print(''.join(t))

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

Solution (Python):
t = input()
t += "O"

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

StrA = "".join(str)
print(StrA[:-1])

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())
t_bara = list(t)

for i in range(len(t_bara)):
    if t_bara[i] == "?":
        t_bara[i]= t_bara[i].replace("?","D")

print(''.join(t_bara))

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


for a in range(length-1, -1, -1):
    
    if t[a] == '?':
        if a == length - 1:
            t[a] = 'D'
            continue

    
    if t[a] == '?' and a == 1:
        if t[a+1] == 'P':
            t[a] = 'D'

        elif t[a+1] == 'D':
            t[a] = 'D'

    
    if t[a] == '?':
        if t[a+1] == 'P':
            if t[a-1] == 'P':
                t[a] = 'D'
            elif t[a-1] == 'D':
                t[a] = 'D'
            elif t[a-1] == '?':
                t[a] = 'D'

        elif t[a+1] == 'D':
            if t[a-1] == 'P':
                t[a] = 'D'
            elif t[a-1] == 'D':
                t[a] = 'P'
            elif t[a-1] == '?':
                t[a] = 'D'

print(''.join(t))

Solution (Python):
n = input()

n = n.replace("?","D")

d = n.count("D")
pd= n.count("PD")

print( n)

Solution (Python):

import sys
input = sys.stdin.readline
T =list(input().strip())

    
if T[0] =="?":
    if len(T) ==1 :
        T[0] ="D"
    elif T[1] =="?":
        T[0] ="P"
        T[1] ="D"
    elif T[1] =="D":
        T[0] ="P"
    else:
        T[0] ="D"


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

if T[-1] =="?":
    T[-1] ="D"

print("".join(T))

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

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

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

Solution (Python):
T = list(input())
ex=None
for i in range(len(T)):
  if T[i] == "?":
    if ex == "P" or ex == None:
      T[i] = "D"
    else:
      if len(T)-1 == i:
        T[i] = "D"
      elif T[i+1] == "D" or T[i+1] == "?":
        T[i] = "P"
      else:
        T[i] = "D"
  ex = T[i]
print("".join(T))

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




















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

print("".join(s))

Solution (Python):

"""AtCoder nomura 2020: B - Postdocs - 
https://atcoder.jp/contests/nomura2020/tasks/nomura2020_b
"""

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

def main():
    T = input()

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


if __name__ == '__main__':
    main()

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

def main():
    Td = T.replace('?', 'D')
    print(Td)
    
if __name__ == "__main__":
    main()

Solution (Python):



list = input()
ans_list = []


for i in range(len(list)):
    if list[i] == "?":
        ans_list.append("D")
    else:
        ans_list.append(list[i])


for i in range(len(list)):
    print(ans_list[i], end="")

Solution (Python):
T=list(input())
if len(T)==1:
  print('D')
  exit()
if T[0]=='?' and T[1]=='D':
  T[0]='P'
elif T[0]=='?' and T[1]=='?':
  T[0]='P'
elif T[0]=='?' and T[1]=='P':
  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]=='P':
    T[i]='D'
  elif T[i]=='?' and T[i+1]=='?':
    T[i]='P'
if T[-1]=='?':
  T[-1]='D'
  
print(''.join(T))

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

Solution (Python):
t = str(input())
s =""
for i in range(len(t)-1):
    if(i>=1):
        if(t[i]=='?'):
          if(s[-1]=="P"):
              s+="D"
          elif(t[i+1]=='D')or(t[i+1]=='?'):
              s += "P"
          elif(t[i+1]=='P'):
              s+="D"
        else:
          s+=t[i]
    else:
        if(t[i]=='?'):
          if(t[i+1]=='D')or(t[i+1]=='?'):
              s += "P"
          elif(t[i+1]=='P'):
              s+="D"
        else:
          s+=t[i]
if(t[len(t)-1]=="?"):
    s+="D"
else:
    s+=t[len(t)-1]
print(s)

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

for i, code in enumerate(s):
    
    
    
    
    
    
    if code =='?':
        s[i] = 'D'

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

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

for i in range(len(s)):
  if s[i] == '?':
    if i-1 >= 0 and s[i-1] == 'P':
      s[i] = 'D'
    elif 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))

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

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

print(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()
print(T.replace('?','D'))

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

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

print("".join(T))

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

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

print(S)

Solution (Python):
text = input().replace("?", "D")
d    = text.count("D")
pd   = text.count("PD")
print(text)

Solution (Python):
t= list(input())
if t[-1] == '?':
  t[-1] = 'D'

if t[0] == '?':
  if t[1] == 'D':
    t[0] = 'P'
  elif t[1] == 'P':
    t[0] = 'D'
  else:
    t[0] = 'P'
    t[1] = 'D'

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

Solution (Python):
A = input()

moji = A.replace("?", "D")

print(moji)

Solution (Python):
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 and l[i+1]!='P':
      l[i] = 'P'
    elif i == 0:
      l[i] = 'D'
    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)

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

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

length = len(T)
count = 0
ans = 0
for i in T:
    if i == '?':
        T[count] = 'D'
        ans += 1
    elif i == 'P' and count != length-1:
        if T[count+1] == 'D' or T[count+1] == '?':
            ans += 1
    elif i == 'D':
        ans += 1

    count += 1

print(''.join(T))

Solution (Python):
S=input()

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

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

Solution (Python):
import sys







s = input()
ans =""
if len(s)==1:
    if s[0]=="?":
        print("D")
        sys.exit()
    else:
        print(s[0])
        sys.exit()

if s[0]=="?":
    if s[1]=="D" or s[1]=="?":
        ans = ans+"P"
    else:
        ans = ans + "D"
else :
    ans = ans + s[0]

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

print(ans)

Solution (Python):


t = input()

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

Solution (Python):
t = input()
ans = []

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

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

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

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def solve():
    t = S()
    for i in t:
        if i == "?":
            print("D", end="")
        else:
            print(i, end="")
    print()
    return



if __name__ == '__main__':
    solve()

Solution (Python):
t = input()
ans=t.replace('P?','PD')
ans=ans.replace('?D','PD')
ans=ans.replace('??','PD')
ans=ans.replace('?','D')
print(ans)

Solution (Python):
t=input()

if t[0]=="?":
  s="D"
else:
  s=t[0]
  
  
for i in range(1,len(t)):
  if t[i]=="?":
  	s+="D"
  else:
    s+=t[i]
    
print(s)

Solution (Python):
T = input()

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

Solution (Python):
s = input()
n = len(s)
news = []
for l in s:
  news.append(l)
s = news
for i in range(n):
  if s[i] == '?':
    s[i] = 'D'
print(''.join(s))

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

Solution (Python):
a = input()
b = len(a)
c = []
for i in range(b):
    d = a[i]
    if d == '?':
        d='D'
    else:
        d = a[i]
    c.append(d)
print(''.join(c))

Solution (Python):
T = input()
T = "S" + T + "S"

T_list = []
for i in range(len(T)):
    T_list.append(T[i])

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

ans = ""
for t in T_list[1:-1]:
    ans += t
print(ans)

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



if T[0:2] == '?D':
    T[0] = 'P'
for i,t in enumerate(T):
    if t == '?':
        T[i] = 'D'
print(''.join(T))

Solution (Python):
N = input()
LISTSTR = list(N)

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


    if str != '?':
        ans += str
    elif mae == '?':
        ans += 'D'
    else:
        ans += 'D'


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



print(ans)

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

Solution (Python):
t = list(map(str, input()))
ans = t[:]

if len(t) == 1:
    if t[0] == "?":
        ans[0] = "D"
else:
    if t[0] == "?":
        if t[1] == "P":
            ans[0] = "D"
        else:
            ans[0] = "P"

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

    if t[-1] == "?":
        ans[-1] = "D"

print("".join(ans))

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

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

Solution (Python):
import os
import sys
from io import BytesIO, IOBase
def main():
    s=input()
    s=list(s)
    for i in range(len(s)):
        if(s[i]=="?"):
                s[i]="D"
            
    print("".join(s))
            



BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def input():
    return sys.stdin.readline().rstrip("\r\n")


def write(*args, end="\n"):
    for x in args[:-1]:
        sys.stdout.write(str(x) + " ")
    sys.stdout.write(str(args[-1]))
    sys.stdout.write(end)


def r_array():
    return [int(x) for x in input().split()]


def r_int():
    return int(input())


if __name__ == "__main__":
    main()

Solution (Python):
t = input()

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

Solution (Python):
N=input()
ans = ''
p=''
for i in range(len(N)-1):
    if N[i]=='?':
        if p=='P':
            ans+='D'
        elif N[i+1]=='D':
            ans+='P'
        elif N[i+1]=='P':
            ans+='D'
        else:
            ans+='P'
        
    else:
        ans+=N[i]
    p=ans[-1]

if N[len(N)-1]=='?':
    ans+='D'
else:
    ans+=N[len(N)-1]
print(ans)

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

for i in range(len(s)):

   if s[i] =="?":
      try:
          if s[i+1] =="D" and s[i-1] =="D":
              s[i] ="P" 
          else:
            s[i] ="D" 
      except:
          s[i] ="D" 
print("".join(s))

Solution (Python):
T=str(input())
cnt=0
cc=[]
count=len(T)
for i in T:
    if i=='P':
        cnt=1
        cc.append('P')

    elif i=='D':
        cnt=0
        cc.append('D')
    else:
        if count == i:
            cc.append('D')

        elif cnt==1:
            cnt=0
            cc.append('D')
        else:
            cnt=1
            cc.append('?')

ccc=1
for i in cc:
    if i=='P':
        print('P',end='')
    elif i=='D':
        print('D',end='')
    else:
        if ccc==len(cc):
            print('D')
        elif cc[ccc]=='P':
            print('D',end='')
        else:
            print('P',end='')
    ccc+=1

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

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

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

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

n = len(T)
T.append("P")
T.insert(0,"D")


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

   








print("".join(T[1:n+1]))

Solution (Python):
T = input()
ans = ""



















for i in range(len(T)):
    if T[i] == "?":
        ans += "D"
    else:
        ans += T[i]
print(ans)