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 = input()
skip = -1
t = list(t)
ans = []
for i,j in enumerate(t):
    if j == "?":
        if i == 0 or i == len(t)-1:
            ans.append("D")
        else:
            if ans[i-1] == "P":
                ans.append("D")
            else:
                if t[i+1] == "?":
                    ans.append("P")
                else:
                    ans.append("D")
    else:
        ans.append(j)
print("".join(ans))

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

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

Solution (Python):
T=input()
new_T=''
for i in T:
    if i=='?':
        i='D'
    new_T=new_T+i
print(new_T)

Solution (Python):


"""
    Author : thekushalghosh
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()


    
def solve():
    t = insr()
    print(t.replace("?","D"))
        


 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
    sys.stdout.close()
    

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))


def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
    
main()

Solution (Python):
import sys


MODE = 1


DIMENSION = 0


INT_TYPE = 0

if not (MODE):
    with open("input.txt", "r") as f:
        s = f.read()
else:
    s = sys.stdin.read()

if DIMENSION == 0:
    if INT_TYPE == 1:
        s = int(s)
elif DIMENSION == 1:
    if INT_TYPE == 0:
        s = s.split()
    elif INT_TYPE == 1:
        s = [int(x) for x in s.split()]
elif DIMENSION == 2:
    if INT_TYPE == 0:
        s = [x.split() for x in s.splitlines()]
    elif INT_TYPE == 1:
        s = [[int(y) for y in x.split()] for x in s.splitlines()]

ss = [None for _ in range(len(s))]
for i, t in enumerate(s):
    if t == "?":
        ss[i] = "D"
    else:
        ss[i] = t
print(''.join(ss))

Solution (Python):
t = input()

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

Solution (Python):
def func2(l, value):
    i = -1
    c = len(l)
    result = []
    while i < c:
        try:
            i = l.index(value, i + 1)
            result.append(i)
        except:
            return result
    return result

T=list(input())
que_list=(func2(T,"?"))
for i in que_list:
    T[i]='D'
print(''.join(T))

Solution (Python):
from collections import deque

T = input()
for s in T:
    if s == "?":
        print("D", end = "")
    else:
        print(s, end = "")
print()

Solution (Python):
T = input()

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

Solution (Python):
import sys
import math
import itertools
s = input()
ans=''
for i in range(len(s)):
    if(s[i]=='?'):
        ans+='D'
    else:
        ans += s[i]
print(ans)

Solution (Python):
t = input()

ans = ""

if t[0] == '?':
    ans += 'D'
else:
    ans += t[0]

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

if t[len(t)-1] == '?' and len(t) != 1:
    ans += 'D'
elif len(t) != 1:
    ans += t[len(t)-1]

print(ans)

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

Solution (Python):
from sys import stdin, stdout  
  
def main(): 
	T = (stdin.readline().rstrip())
	
	
	T = T.replace('?', 'D')
	stdout.write(str(T)+'\n')

if __name__ == "__main__": 
	main()

Solution (Python):
T=input()
for i in range(len(T)):
    if T[i]=='?' or T[i]=='D':
        print('D',end='')
    else:
        print('P',end='')

Solution (Python):
s = input()

while "?" in s:
  s = s.replace("?","D")
print(s)

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

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

print(''.join(s))

Solution (Python):

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left 
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

T = input()

res = ''
for i, t in enu(T):
    if t=='?':
        res += 'D'
    else:
        res += t

print(res)

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

Solution (Python):


T = input()
a = 'a'

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

print("{}".format(a[1:]))

Solution (Python):
if __name__ == "__main__":

    pd = input()

    pd_replace = pd.replace('?','D') 

    
    
    
    
    
    

    print(pd_replace)

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

Solution (Python):
S = input()

lis = []

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

print("".join(str(x) for x in lis))

Solution (Python):

import sys


input = sys.stdin.readline
def IS(cb): return cb(input().strip())
def IL(cb): return [cb(s) for s in input().strip().split()]
def IR(cb, rows): return [IS(cb) for _ in range(rows)]
def ILL(cb, rows): return [IL(cb) for _ in range(rows)]


def solve():
    T = IS(str)
    S = ''
    for i in range(len(T)):
        if T[i] == '?':
            S += 'D'
        else:
            S += T[i]
    
    print(S)

solve()

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

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

Solution (Python):
str = input()
length = len(str)
ans = [""] * length
for x in range(length):
    if str[length - (x + 1)] == "P":ans[length - (x + 1)] += "P"
    elif str[length - (x + 1)] == "D":ans[length - (x + 1)] += "D"
    elif str[length - (x + 1)] == "?":
        if x == 0 or x == length - 1: ans[length - (x + 1)] = "D"
        elif ans[length - x] == "P": ans[length - (x + 1)] = "D"
        elif ans[length - x] == "D" and str[length - (x + 2)] == "P": ans[length - (x + 1)] = "D"
        elif ans[length - x] == "D" and str[length - (x + 2)] == "D": ans[length - (x + 1)] = "P"
        elif ans[length - x] == "D" and str[length - (x + 2)] == "?": ans[length - (x + 1)] = "P"
print(''.join(ans))

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

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

Solution (Python):

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

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

    
    
    
    
    
    
    
    print(T)


if __name__ == '__main__':
    main()

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

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

Solution (Python):

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

      
      if t[i+1] == "D":
        t[i] = "P"
        continue

      t[i] = "D"


print("".join(t))

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

    elif t[i]=='D':
        ans += 1
        
p = ''
for i in t:
    p += i
print(p)

Solution (Python):

import sys


def solve(T: str):
    T = [t if t!='?' else 'D' for t in T]
    print(''.join(T))
    return

    cnt = 0
    max_pd = 0
    prev_c = ''
    
    for idx, c in enumerate(T):

        if c == 'd':
            cnt += 1
        
        elif idx==len(T)-1:
            max_pd = max(max_pd, cnt)
            cnt = 0
            break
        elif T[idx+1]=='d':
            cnt += 1
        else:
            max_pd = max(max_pd, cnt)
            cnt = 0

    print(max_pd)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    T = next(tokens)  
    solve(T)

if __name__ == '__main__':
    main()

Solution (Python):
T = input()
ans = ''
for i in range(len(T)):
    if T[i] == '?':
        ans += 'D'
    elif T[i] == 'P':
        ans += 'P'
    else:
        ans += 'D'
print(ans)

Solution (Python):
T=input()




T_hoge=[]

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

A=''.join(T_hoge)
print(A)

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

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

Solution (Python):
T = input().strip()

result = []
score = 0
prev = None
for c in T:
	if c == "D" or c == "?":
		if prev == "P":
			score += 2
		else:
			score += 1
		result.append("D")
		prev = "D"
	elif c == "P":
		result.append("P")
		prev = "P"

print("".join(result))

Solution (Python):
s=list(input())
i=0
while(i<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'
    i+=1
z=''.join(s)
print(z)

Solution (Python):
T = list(input())
res = [T[0] if T[0] != '?' else 'D']
for prev, cur in zip(T, T[1:]):
    if cur != '?':
        res.append(cur)
    else:
        res.append('D')
print(''.join(res))

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

Solution (Python):
T=input()

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

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

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

Solution (Python):
t = input()

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

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

Solution (Python):
t = input()

ans = ""

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

Solution (Python):

"""this is python work script"""

def solver(s):
    """solve this problem"""
    s_li = list(s)
    for i, word in enumerate(s_li):
        if word == '?':
            s_li[i] = 'D'
    answer = ''.join(s_li)
    return answer

def main():
    """main function"""
    S = input().rstrip()
    answer = solver(S)
    print(answer)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
a=input()
i=0
while i<len(a):
    if a[i]=='?':
        print(end='D')

    else:
        print(end=str(a[i]))
    i=i+1

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

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

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

ans=""
for i in range(N):
  if T[i]=="D" or T[i]=="P":
    ans+=T[i]
  else:
    ans+="D"
print(ans)

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

Solution (Python):
t = input()

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

Solution (Python):
t = input()

n= len(t)

count = 0

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

print(s)

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

T = input()

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

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

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

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

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

Solution (Python):
T = str(input())
ans = ''
for t in T:
    if t != '?':
        ans += t
    else:
        ans += 'D'
print(ans)

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

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

if T[-1] == "?":
    T[-1] = "D"
print("".join(T), sep="")

Solution (Python):
s = input()
s = s.replace('?','D')
pdCnt = s.count('PD')
dCnt = s.count('D')
print(s)

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

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

print(T2)

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

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

t = ["D" if i == "?" else i for i in t]

for i in t:
    print(i,end="")

Solution (Python):
def resolve():
    T = input()
    T = T.replace("P?", "PD")
    T = T.replace("?D", "PD")
    T = T.replace("?", "D")
    print(T)


resolve()

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

Solution (Python):
def mips():
    return map(int,input().split())
def ii():
    return int(input())
T = input()
t = len(T)
ans = ""
for i in range(t-1):
    if T[i] == "?":
        if i == 0:
            if T[i+1] == "D":
                ans += "P"
            else:
                ans += "D"
        else:
            if T[i-1] == "D" and T[i+1] == "?":
                ans += "P"
                continue
            else:
                ans += "D"
    else:
        ans += T[i]
if T[-1] == "?":
    ans += "D"
else:
    ans += T[-1]
print(ans)

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

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

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):
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] == "D":
			s[i] = "P"
		elif s[i] == "?":
			s[i] = "D"

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

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


if __name__ == '__main__':
	main()

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

if __name__ == '__main__':
    main()

Solution (Python):
T = input()

for t in T:
    if t == '?':
        print('D', end='')
    else:
        print(t, end='')

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

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

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

Solution (Python):
t=list(input())
if len(t)==1:
    if t[0]=="?":
        print("D")
    else:
        print(*t)
    exit()
if t[0]=="?":
    if 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"
        elif t[i-1]=="D":
            if t[i+1]=="P":
                t[i]="D"
            else:
                t[i]="P"
if t[-1]=="?":
    t[-1]="D"
print(*t,sep="")

Solution (Python):















t = list(input())






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

print("".join(t))

Solution (Python):
t = input()

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

Solution (Python):
t=input()

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

result = ""
for i in T:
    if i == "?":
        result = result + "D"
    else:
        result += i
print(result)

Solution (Python):
print(''.join(['D' if c == '?' else c for c in input()]))

Solution (Python):
s = input()
result = ""
for i in range(len(s)):
    if s[i] == '?':
        result += 'D'
        continue
    result += s[i]

print(result)

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

Solution (Python):
T = input()

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

Solution (Python):


t = input()

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

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

Solution (Python):
t = input()


max = 0
tmp = 0

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



tmp = t.count('D')


tmp += t.count('PD')

max = tmp

print(t)

Solution (Python):
import re


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

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

print(T2)

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

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

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

if __name__ == '__main__':
    main()

Solution (Python):
def resolve():
    t = input()

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

Solution (Python):




string = input()

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

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

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

if t[0] == '?':
    if n > 1:
        if t[1] == '?':
            t[0] = 'P'
        else:
            t[0] = 'D'
    else:
        t[0] = 'D'
if t[-1] == '?':
    t[-1] = 'D'
for i in range(1,n-1):
    if t[i] == '?':
        if t[i-1] == 'P':
            t[i] = 'D'
        else:
            if t[i+1] == '?' or t[i+1] == 'D':
                t[i] = 'P'
            else:
                t[i] = 'D'

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

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

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

print(*t, sep='')

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

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

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

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

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

Solution (Python):
T = input()

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

Solution (Python):
def solve():
    INF = float('inf')
    P = 0
    D = 1

    Ts = input().rstrip()

    N = len(Ts)

    dp = [[-INF]*(2) for _ in range(N+1)]
    dp[0][D] = 0
    prevss = [[-1]*(2) for _ in range(N+1)]
    for i, T in enumerate(Ts, start=1):
        if T == 'P' or T == '?':
            dpP = dp[i-1][P]
            dpD = dp[i-1][D]
            if dpP >= dpD:
                dp[i][P] = dpP
                prevss[i][P] = P
            else:
                dp[i][P] = dpD
                prevss[i][P] = D
        if T == 'D' or T == '?':
            dpP = dp[i-1][P] + 2
            dpD = dp[i-1][D] + 1
            if dpP >= dpD:
                dp[i][D] = dpP
                prevss[i][D] = P
            else:
                dp[i][D] = dpD
                prevss[i][D] = D

    
    

    if dp[-1][P] >= dp[-1][D]:
        j = P
    else:
        j = D
    anss = [j]
    for i in reversed(range(2, N+1)):
        j = prevss[i][j]
        anss.append(j)
    

    anss = ''.join(['P' if ans == P else 'D' for ans in anss[::-1]])
    print(anss)


solve()

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

tmp = T.replace('P?','PD')
tmp1 = tmp.replace('?D','PD')
tmp2 = tmp1.replace('??','PD')
tmp3 = tmp2.replace('?','D')

print(tmp3)

Solution (Python):
s = input()
n = len(s)

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

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

Solution (Python):
t = input()

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

print(ans)

Solution (Python):
t = (input().rstrip())
k = len(t)
l = []
for i in range(k):
    if t[i] =="?" :
        l.append("D")
    else :
        l.append(t[i])
for j in range(k):
    print(l[j],end="")

Solution (Python):
T = bytearray(input().encode())

if T[0] == b'?'[0]:
  T[0] = b'P'[0] if len(T) > 1 and T[1] != b'P'[0] else b'D'[0]

for i, (old, c, new) in enumerate(zip(T, T[1:], T[2:]), start=1):
  if c == b'?'[0]:
    T[i] = b'D'[0] if new == b'P'[0] or old == b'P'[0] else b'P'[0]

if T[-1] == b'?'[0]:
  T[-1] = b'D'[0]
  
print(T.decode())

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

Solution (Python):
S = input()
ans = ''
for i in range(len(S)):
  if S[i] == '?':
    ans += 'D'
  else:
    ans += S[i]
print(ans)

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

Solution (Python):
t = input()

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

Solution (Python):
T = input()

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

print(ans)

Solution (Python):
k = list(input())
q = [i for i in range(len(k)) if k[i] == "?"]
p = [i for i in range(len(k)) if k[i] == "P"]
d = [i for i in range(len(k)) if k[i] == "D"]

for i in q:
  if i == 0 or i == len(k) - 1:
    k[i] = "D"
  else:
    if k[i -1] == "D" and k[i + 1] == "D":
      k[i] = "P"
    else:
      k[i] = "D"
print("".join(k))

Solution (Python):
T = input()
ans = ''
for i in range(len(T)):
  if T[i] != '?':
    ans += T[i]
    continue
  if i != 0 and ans[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)

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

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

Solution (Python):
import sys
input = sys.stdin.readline
S = input()
print(S.replace('?', 'D'))

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

Solution (Python):
t = list(input())
for i in range(len(t)):
    if t[i] == "?":
        
        print("D",end = "")
    else:
        print(t[i],end = "")

Solution (Python):
T = list(input())
N = len(T)
for i in range(N):
    if T[i] == '?':
        if 0 <= i-1 and T[i-1] == 'P':
            T[i] = 'D'

T = list(''.join(T).replace('??', 'PD'))

for i in range(N):
    if T[i] == '?':
        if i+1 < N and T[i+1] == 'D':
            T[i] = 'P'

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

Solution (Python):
t = input()

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

c = t.count('D')
c += t.count('PD')

print(t)

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

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

target_x = target.replace('?','D')

print(target_x)

Solution (Python):
T = input()

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

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

Solution (Python):


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

Solution (Python):


T = list(input())

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

    if i == 0 :
        if T[i] != '?' :
            ans += T[i]
        else :
            if T[i+1] == 'P' :
                ans += 'D'
            else :
                ans += 'P'
        continue
    
    if T[i] != '?' :
        ans += T[i]
        continue

    if ans[i-1] == 'P' :
        ans += 'D'
    elif ans[i-1] == 'D' :
        if T[i+1] == 'P' :
            ans += 'D'
        else :
            ans += 'P'

print(ans)

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

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

Solution (Python):
from sys import stdin
def S(): return stdin.readline().rstrip()

t = S()
lt = list(t)

for i,item in enumerate(lt):
    if item == '?':
        if i<len(lt)-1:
            if 0<i:
                if lt[i-1]=='P':
                    lt[i] = 'D'
                else:
                    if lt[i+1]=='D' or lt[i+1]=='?':
                        lt[i] = 'P'
                    else:
                        lt[i] = 'D'
            else:
                if lt[i+1]=='D' or lt[i+1]=='?':
                    lt[i] = 'P'
                else:
                    lt[i] = 'D'
        else:
            if item=='?':
                lt[i] = 'D'

ans = ''
for i in lt:
    ans += i
print(ans)

Solution (Python):
def main(T):
    ans = list(T)
    for i, s in enumerate(T):
        if s == '?':
            ans[i] = 'D'
    print(''.join(ans))
    
    
    
    
    
    
    


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

Solution (Python):
T = input()
T = [t for t in T]
where = [j for j, i in enumerate(T) if i == '?']
for i in where:
    if i -1 >= 0 and T[i-1] == 'P':
        T[i] = 'D'
    elif i + 1 < len(T)-1 and T[i+1] == 'D':
        T[i] = 'P'
    elif i + 1 < len(T)-1 and T[i+1] == '?':
        T[i] = 'P'
    else:
        T[i] = 'D'
ans = ''
for t in T:
    ans += t
print(ans)

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

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

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

Solution (Python):

T = str(input())


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

Solution (Python):
T=input()

result=[]

for i in range(len(T)):
    if T[i]=='?':
        if i==len(T)-1:
            result.append('D')
        elif i==0:
            if T[i+1]=='P':
                result.append('D')
            else:
                result.append('P')
        elif result[i-1]=='P':
            result.append('D')
        else:
            if T[i+1]=='P':
                result.append('D')
            else:
                result.append('P')
    else:
        result.append(T[i])

print(''.join(result))

Solution (Python):
T = input()

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

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

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

Solution (Python):

import collections
from functools import lru_cache

def solve(s):
    s = [ch for ch in s]
    n = len(s)

    for i, ch in enumerate(s):
        if ch == "?":
            s[i] = "D"

    return "".join(s)


s = input().strip()
print(solve(s))

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

indices = [i for i,t in enumerate(T_list) if t=="?"]
for i in indices:
    T_list[i]="D"
answer=""
for t in T_list:
    answer+=t
print(answer)

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

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

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

    print("".join(T))


if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    main()

Solution (Python):
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]='D'
print(''.join(T))