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 numpy as np




T = input()
n = len(T)
S = ''

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

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

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

s = input()

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

print(t)

Solution (Python):
T=input()
res=''
for i in range(len(T)):
	if T[i]=='?':
		if i==0:
			if len(T)==1:
				res+='D'
			else:
				if T[i+1]=='P':
					res+='D'
				else:
					res+='P'
		else:
			if i+1<len(T):
				if res[i-1]=='P' or T[i+1]=='P':
					res+='D'
				else:
					res+='P'
			else:
				res+='D'
	else:
		res+=T[i]
print(res)

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

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

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

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

if t[-1] == "?":
    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"
            else:
                t[i] = "P"

print("".join(t))

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

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

print("".join(s))

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

Solution (Python):
t = input()
cnt = 0
ans = []
for i in range(len(t)-1):

    a,b,c = t[i],t[i-1],t[i+1]
    if a == "?" and c == "P":
        ans.append("D")
    elif a == "?" and b == "D":
        ans.append("P")
    elif a == "?":
        ans.append("D")
    else: ans.append(a)
if (t[-1] == "?") :ans.append("D")
else: ans.append(t[-1])

print(*ans,sep="")

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

for i in range(T_len):
    if S[i]=="?":
        if S[i-1]=="D" and (S[i+1]=="D" or S[i+1]=="?"):
            S[i]="P"
        else:
            S[i]="D"
str_changed = "".join(S)
print(str_changed)

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

Solution (Python):
S = input()

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

Solution (Python):
import re


t = input()












    




result = re.sub(r'\?', 'D', t)
print(result)

Solution (Python):

import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement


from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter





j=0
k=0
n=3
r=1
a=[0]






"1行1つの整数を入力を取得し、整数と取得する"




"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

for i in number_list:
    print(number_list[i-1])

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''



"正方行列にstr型の値を入力"
'''




'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''











'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''




"aという変数に入っているものを大文字にして出力"

















'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''


'''
def cmb(n,r):
    
    r= min(n-r,r)
    
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    
    
    

    under = reduce(mul, range(1, r+1))
    
    
    
    

    return over // under
    
    
    
    
a = cmb(n, r)

'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD
combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''




for i in a.most_common(n):print(i)





 


'''









'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

'''
素数の判定
'''
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        
        if n % k == 0:
            return False
            
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  

'''

def factorial(x, mod=10**9+7):
    
    
    
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp
    '''
    Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
    But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
    '''
"
def gcd(a, b):
    while b:
        
        
        a, b = b, a % b
    return a

"
def lcm(a, b):
    return a * b // gcd (a, b)

"
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table











'''
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '0123456789'
hexdigits = '0123456789abcdefABCDEF'
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv...\xaf\xb0...
lowercase = 'abcdefghijklmnopqrstuvwxyz'
octdigits = '01234567'
printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU...
punctuation = '!"
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
whitespace = '\t\n\x0b\x0c\r '
'''
'''
引数endに任意の文字列を指定すると、その文字列が改行の代わりに最後に挿入される。例えば連続するprint()の出力を改行なしで単純に連結したい場合は空文字列''を指定すればよい。

print('abc', end='---')
print('xyz')


print('abc', end='')
print('xyz')

source: print_basic.py
なお、デフォルトで改行されるのは引数endのデフォルト値が改行文字'\n'に設定されているから。
'''

def main():
    n=3
    steps=0
    state=0
    w=1
    j=0
    k=0
    
    
    
    
    
    s=input()
    a=[i for i in s]
    
    
    n=len(a)
    d=[]
    sum=0
    for i in range(n):
        
        
        
        
        if a[i]=='?':
            a[i]='D'
    print(''.join(a))
    
    
    
    


    
    
     

    l = ['aaa', 'bbb', 'ccc']
    x=l.index('aaa')
    
    
    
    

    
        
    
    

    
    
    
    
    DP = np.zeros(w+1, dtype=int)
    exdp=np.zeros((3,4)) 
    
    
    
        
        
    
    
        
        
    


    
    



    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]
    

    ls = ["a", "b", "c", "d", "e"]


    
    

    
    

    
    
    
    
    
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

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

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

Solution (Python):
a = input()
i = 0
g = []
while i < len(a) :
    if a[i] != "?" :
        g.append(a[i])
    if a[i] == "?":
        g.append("D")
    i = i + 1
print("".join(g))

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

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

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

Solution (Python):
t = input()
m=len(t)
s = ''
for i in range(len(t)):
    if t[i] == 'P' or t[i] == 'D':
        s = s + t[i]
         
    if t[i] =='?':
        s = s+'D'
print(s)

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

Solution (Python):
T = input()

t1 = T.replace("P?","PD")
t2 = t1.replace("?","D")

print(t2)

Solution (Python):
z=""
a=list(input())
for i in (a):
    if i=='?':
       z=z+'D'
    else:
        z=z+i
print(z)

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

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

Solution (Python):
T = input()


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

Solution (Python):
T = input()
T_len = int(len(T))
S = ""
for i in range(T_len):
  if T[i] == '?':
    S = "D"
  else:
    S = T[i]
  print(S, end = "")

Solution (Python):
t = input()

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

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

Solution (Python):
t = input()

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

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

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

print(''.join(s))

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

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

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

Solution (Python):
t = input()

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

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

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

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

    q_list = []

    for i in range(len(t)):
        if t[i] == '?':
            q_list.append(i)

    for q in q_list:
        if q != 0 and t[q-1] == 'P':
            t[q] = 'D'
        elif q != len(t)-1 and t[q+1] == 'D':
            t[q] = 'P'
        else:
            t[q] = 'D'

    print(''.join(t))
    

if __name__ == '__main__':
    main()

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

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"
print("".join(t))

Solution (Python):
import sys
a =[]
for l in sys.stdin:
  for char in l:
    if char == "?":
      char = "D"
    a.append(char.strip())
for char in a:
	print(char, end="")

Solution (Python):
T = list(input())
for i in range(len(T)):
    if i == 0:
        if T[i] == "?":
            if len(T) == 1:
                T[i] = "D"
                break
            if T[i+1] == "D":
                T[i] = "P"
            else:
                T[i] = "D"
    else:
        if T[i] == "?":
            T[i] = "D"
print("".join(T))

Solution (Python):
from collections import deque

def main():
    T = input()
    d = deque(T)
    ans = deque()
    nxt = ""
    cnt = 0

    while d:
        now = d.pop()
        if now == "?":
            now = "D"
        ans.appendleft(now)

    print("".join(ans))
    

if __name__ == "__main__":
    main()

Solution (Python):
t = input()
ans = [0]*(len(t))

for i,c in enumerate(t):
    if c=="?":
        ans[i] = "D"
    else:
        ans[i] = t[i]
print(*ans,sep="")

Solution (Python):








t = list(input())
dp = [0] * (len(t) + 1)

ans = []
swich = 0

for i in range(0,len(t)):

    if t[i] == "?":
        ans.append("D")
    else:
        ans.append(t[i])
print("".join(ans))

Solution (Python):

s = input()

s = list(s)






nagasa = len(s)

for m in range(nagasa):
    for i in s[m]:
        if i == '?':
            s[m] = 'D'
        else:
            pass

print(''.join(s))

Solution (Python):
from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

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


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

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

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

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

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

Solution (Python):
T = input()

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

print(T)

Solution (Python):
T=input()

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

Solution (Python):

T = input()

ans = ''

"""
i = 0
while i < len(T)-1:
    
    if T[i] == 'P':
        ans += 'P'
    elif T[i] == 'D':
        ans += 'D'
    elif T[i] == '?':
        if T[i:i+2] == '??':
            ans += 'PD'
            i += 1
        elif T[i:i+2] == '?P':
            ans += 'DP'
            i += 1
        elif T[i:i+2] == '?D':
            ans += 'PD'
            i += 1
    i += 1
    


if not i == len(T):
    if T[-1] == '?':
        ans += 'D'
    else:
        ans += T[-1]
"""

for t in T:
    if t == '?':
        ans += 'D'
    else:
        ans += t



print(ans)

Solution (Python):
a = input()

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

Solution (Python):
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

t = L()

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

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

Solution (Python):
t = input()















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

Solution (Python):
def main():
    S=input()
    res=""

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

if __name__=="__main__":
    main()

Solution (Python):
def resolve():
    t = input()
    ans = []
    is_pre_p = False
    for c in t:
        if c == '?':
            ans.append('D')
        else:
            ans.append(c)

    print("".join(ans))

resolve()

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

cnt += T.count('D')
cnt += T.count('PD')



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

tmp = 0

tmp += S.count('D')
tmp += S.count('PD')

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

Solution (Python):


T = list(str(input()))
len_T = len(T)

for i in range(len_T):
    if T[i] == '?':
        T[i] = 'D'
        
print(''.join(map(str, T)))

Solution (Python):
T = input() 

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

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

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

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

print(*T, sep="")

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

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

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

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




S = S()
ans = []
temp = []
prev = None
for s in S:
  if s == "?":
    if s == prev:
      temp.append(s)
    else:
      if temp:
        ans.append("".join(temp))
      temp = ["?"]
  else:
    if prev != "?":
      temp.append(s)
    else:
      if temp:
        ans.append("".join(temp))
      temp = [s]
  prev = s
if temp:
  ans.append("".join(temp))

final_ans = []
for i in range(len(ans)):
  if ans[i][0] == "?":
    if i == 0:
      if i != len(ans)-1:
        n = ans[i+1][0]
        if n == "P":
          if len(ans[i])%2==0:
            final_ans.append("PD"*(len(ans[i])//2))
          else:
            final_ans.append("D"+"PD"*(len(ans[i])//2))
        else:
          if len(ans[i])%2==0:
            final_ans.append("DP"*(len(ans[i])//2))
          else:
            final_ans.append("P"+"DP"*(len(ans[i])//2))
      else:
        if len(ans[i])%2==0:
          final_ans.append("PD"*(len(ans[i])//2))
        else:
          final_ans.append("D"+"PD"*(len(ans[i])//2))
    elif i == len(ans)-1:
      p = ans[i-1][-1]
      if p == "P":
        if len(ans[i])%2==0:
          final_ans.append("D"+"PD"*(len(ans[i])//2-1)+"D")
        else:
            final_ans.append("D"+"PD"*(len(ans[i])//2))
      else:
        if len(ans[i])%2==0:
          final_ans.append("PD"*(len(ans[i])//2))
        else:
          final_ans.append("PD"*(len(ans[i])//2)+"D")
    else:
      n = ans[i+1][0]
      p = ans[i-1][-1]
      if p == "D":
        if n == "P":
          if len(ans[i])%2==0:
            final_ans.append("PD"*(len(ans[i])//2))
          else:
            final_ans.append("D"+"PD"*(len(ans[i])//2))
        else:
          if len(ans[i])%2==0:
            final_ans.append("DP"*(len(ans[i])//2))
          else:
            final_ans.append("P"+"DP"*(len(ans[i])//2))
      else:
        if len(ans[i])%2==0:
          if n == "D":
            final_ans.append("DP"*(len(ans[i])//2))
          else:
            final_ans.append("DP"*(len(ans[i])//2-1)+"DD")
        else:
          final_ans.append("D"+"PD"*(len(ans[i])//2))
  else:
    final_ans.append(ans[i])

        
          
print(*final_ans,sep="")

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

TP = T.replace('?', 'P')
TD = T.replace('?', 'D')

TPp = TP.count('D') + TP.count('PD')
TDp = TD.count('D') + TD.count('PD')

if max(TPp, TDp) == TPp:
    print(TP)
else:
    print(TD)

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

Solution (Python):

t = list(input())

"""
if t[0] == '?' and len(t) == 1:
    print('D')
    exit()

if len(set(t)) <= 2 and not 'P' in t:
    ans = ''
    for i in range(len(t)):
        ans += 'D'
    print(ans)
    exit()

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

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

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

for index, i in enumerate(T):
    if i != "?":
        continue
    if 0 <= index - 1:
        if T[index - 1] == "P":
            T[index] = "D"
            continue
    if index + 1 < len(T):
        if T[index + 1] == "D":
            T[index] = "P"
            continue
    T[index] = "D"
print("".join(T))

Solution (Python):
import re
s = input()
print(re.sub('\?', 'D', s))

Solution (Python):









import os
import sys




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


if __name__ == "__main__":
    main()

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

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



for i in S:
        if i == '?':
                print('D', end = "")
        else:
                print(i, end = "")
print()

Solution (Python):
data = input()

result = data.replace('?', 'D')

print(result)

Solution (Python):
t = input()
l = len(t)
a = []
b = ""
for i in range(l):
    a.append(t[i])
if a[-1] == "?":
    a[-1] = "D"
for i in range(1, l):
    if a[-i-1] == "?":
        a[-i-1] = "D"
for i in range(l):
    b += a[i]
print(b)

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

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

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

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

    print(''.join(T))

if __name__ == '__main__':

    ABC_86_B()

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

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

print(''.join(T))

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

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

    
    

    

if __name__ == '__main__':
    main()

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

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

text1=[]
def search2(text):
    for i in text:
        if i=="?":
            i="D"
        text1.append(i)
    print("".join(text1))

search2(T)

Solution (Python):
T = input()
S = []
for n in range(0,len(T)):
    if T[n] == "?":
        S.append("D")
    else:
        S.append(T[n])
print("".join(S))

Solution (Python):
from collections import defaultdict 
import math
if __name__ == '__main__':
    
    T = input()
    print(T.replace('?', 'D'))

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


ans=[]
buff="D"

leng=len(T)

for i in range(leng):
    now=T[i]
    if now=="?":
        if (i+1 < leng) and T[i+1] in ["?", "D"]:
            if buff == "P":
                buff="D"
            else:
                buff="P"
        else:
            buff="D"
    else:
        buff=now
    ans.append(buff)


print("".join(ans))

Solution (Python):
T=list(input())
S=['']*len(T)
for i in range(len(T)):
    if T[i] in ['D','P']: S[i]=T[i]
    else: S[i]='D'
print(''.join(S))

Solution (Python):
from sys import stdin
import sys

T = input()
if T == '?':
    print('D')
    sys.exit()
if T[0] == '?' and T[1] == '?':
    T = 'P'+T[1:]
    
t = T[0]
ans = []
if t == '?' and T[1] == 'D':
    ans.append('P')
elif t == '?' and T[1] == 'P':
    ans.append('D')
else:
    ans.append(t)

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

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

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

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

print(s)

Solution (Python):

import sys


def solve(T: str):
    a = ""
    
    for i in range(len(T)):
        t = T[i]
        if t == "?":
            t="D"
        a+=t
        
    print(a)
    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()

for i, v in enumerate(T):
    if v == '?':
        print('D', end='')
    else:
        print(v, end='')
print('\n')

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

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

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

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

res = []

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

print(''.join(res))

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

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

Solution (Python):
import re

txt = input()

s = re.sub("[?]", "D", txt)

print(s)

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

ans = 0
for i in reversed(range(n)):
    if l[i] == '?':
        if not i==0:
            if l[i-1]=="P":
                l[i] = "D"
                continue
        if not i==n-1:
            if l[i+1] == "D":
                l[i] = "P"
                continue
        l[i] = "D"
        
print("".join(l))

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

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

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

print("".join(T))