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):
def main():
    T = input()

    ans = ''
    flag_q = False
    flag_p = False
    for t in T:
        if t != '?':
            if flag_q and t == 'D':
                ans += 'PD'
                flag_q = False
                flag_p = False
            elif flag_q and t == 'P':
                ans += 'DP'
                flag_q = False
                flag_p = True
            else:
                if t == 'P':
                    flag_p = True
                else:
                    flag_p = False
                ans += t
        else:
            if flag_q:
                ans += 'PD'
                flag_q = False
                flag_p = False
            elif flag_p:
                ans += 'D'
                flag_q = False
                flag_p = False
            else:
                flag_q = True

    if flag_q:
        ans += 'D'

    print(ans)


if __name__ == "__main__":
    main()

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

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

key_list = list()
count = 0
while count < n:
    key_list.append(key[count])
    count += 1

ok_list = list()
for i in key_list:
    if i == '?':
        ok_list.append('D')
    else:
        ok_list.append(i)
ok_list = ''.join(ok_list)
print(ok_list)

Solution (Python):
T = input()
L = len(T)
if T[0] is "?" and L > 1 :
    if T[1] is "D":
        T = 'P' + T[1:]
    else:
        T = 'D' + T[1:]
if T[L-1] is "?":
    T = T[:L-1] + 'D'
T = T.replace("P?", "PD")
T = T.replace("?P", "DP") 
T = T.replace("?","D")

print(T)

Solution (Python):
t = list(input())
t.append("null")

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

t.remove("null")
print("".join(t))

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

Solution (Python):
T = input()

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

Solution (Python):
import re
t = input()

ans = [0] * len(t)


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

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

Solution (Python):


iim = lambda: map(int, input().rstrip().split())

def resolve():
    s = input()

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

if __name__ == "__main__":
    resolve()

Solution (Python):
T=input()
n=T.count('?')
def counthakase(s):
    ans=0
    for i in range(len(s)):
        if s[i]=='D':
            ans+=1
            if s[i-1]=='P':
                ans+=1
    return ans
ta=T.replace('?','D')
print(ta)

Solution (Python):
import sys
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

if len(T)==1:
    print("D")
    sys.exit(0)

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

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

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10**7)

ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

s = ns()
s = list(s)

ans = 0
i = 0
while i < len(s):
    if s[i] == '?':
        if i >= 1 and s[i - 1] == 'P':
            s[i] = 'D'
        elif i < len(s) - 1 and s[i + 1] == 'D':
            s[i] = 'P'
        else:
            s[i] = 'D'
    i += 1

print(*s, sep="")

Solution (Python):
s = input()

li = []
for i, c in enumerate(s):
    if c == '?':
        if i == len(s) - 1:
            c = 'D'
        else:
            if i > 0 and li[i - 1] == 'P':
                c = 'D'
            elif s[i + 1] == 'D' or s[i + 1] == '?':
                c = 'P'
            else:
                c = 'D'
    li.append(c)


print(''.join(li))

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

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

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

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


print("".join(T2))

Solution (Python):

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

if s[-1] == "?":
    ans += "D"
else:
    ans += s[-1]

print(ans)

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

if s[-1] == "?":
    s[-1] = "D"
    
for n in range(len(s)-1):
    if s[n] == "?":
        if s[n-1]=="P" and n!=0:
            s[n] = "D"
        elif s[n+1]=="D" or s[n+1]=="?":
            s[n] = "P"
        else:
            s[n] = "D"
print("".join(s))

Solution (Python):
s = list(str(input()))
c = ""
for i in range(len(s)):
    if s[i] == "?":
        s[i] = "D"
for i in range(len(s)):
    c += s[i]
print(c)

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

Solution (Python):
import sys
t=list(input())
for i in range(len(t)):
    if t[i]=="?":
        if len(t)==1:
            print("D")
            sys.exit()
        else:
            if i==0:
                if t[1]=="D":
                    t[0]="P"
                else:
                    t[0]="D"
            elif i==len(t)-1:
                t[i]="D"
            else:
                if 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"
                else:
                    t[i]="D"
print("".join(t))

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

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

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

print(nw1)

Solution (Python):

S_list = list(input())

for i in range(len(S_list)):
  if(S_list[i] == "?"):
    S_list[i] = "D"
      
print(*S_list, sep="")

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

if len(T) == 1:
    if T[0] == '?':
        T[0] = 'D'

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

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

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

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

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

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

if len(t) == 1 and t[0] == "?":
    t[0] = "D"
    print(t[0])
    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] == "?" and t[i-1] == "P":
        t[i] = "D"
    elif t[i] == "?" and t[i+1] == "D":
        t[i] = "P"
    elif t[i] == "?" and t[i+1] == "?":
        t[i] = "P"
        t[i+1] = "D"
    elif t[i] == "?":
        t[i] = "D"
if len(t) > 1:
    if t[-1] == "?":
        t[-1] = "D"

print("".join(t))

Solution (Python):
T = input()

L = len(T)
ans = ""

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

print(ans)

Solution (Python):
ss = input()

ans = ''
b = 'P'
for i in range(len(ss)):
  c = ss[len(ss)-1-i]
  if c == '?':
    if b == 'D':
      if len(ss)-1-i != 0:
        if ss[len(ss)-2-i] == 'P':
          ans = 'D' + ans
          b = 'D'
        else:
          ans = 'P' + ans
          b = 'P'
      else:
        ans = 'P' + ans
        b = 'P'
    else:
      ans = 'D' + ans
      b = 'D'
  else:
    ans = c + ans
    b = c

print(ans)

Solution (Python):
t = input()

import re

t = re.sub(r'P\?', 'PD', t)
t = re.sub(r'\?D', 'PD', t)
t = re.sub(r'\?\?', 'PD', t)
t = re.sub(r'\?', 'D', t)

print(t)

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

Solution (Python):
t = input()

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

L = "".join(kotae)

print(L)

Solution (Python):
S=input()
line=[]
word=list(S)
for i in range(len(word)):
    if word[i]=="?":
        word[i]="D"
        
        
        
        
        
        



print("".join(word))

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

num = len(l)

ans = []
for i in range(num):
    if l[i] == '?':
        ans.append('D')
    else:
        ans.append(l[i])

print(''.join(ans))

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

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

print(ret)

Solution (Python):
t = input()

s = list(t)

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

print(''.join(s))

Solution (Python):
t = input()

stack = ''
for i in range(len(t)):
    word = t[i]
    if word == '?':
        next_word = t[i+1] if i < len(t)-1 else None
        if next_word is None:
            word = 'D'
        else:
            if len(stack) <= 0 and next_word == 'P':
                word = 'D'
            elif len(stack) <= 0 and (next_word == 'D' or next_word == '?'):
                word = 'P'
            elif stack[-1] == 'D' and (next_word == '?' or next_word == 'D'):
                word = 'P'
            else:
                word = 'D'

    stack += word
print(stack)

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

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

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

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

print(rt)

Solution (Python):
import sys
data = list(input())
for i, _str in enumerate(data):
  if _str == "?":
    data[i] = "D"
ans = "".join(data)
print(ans)

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

results = []
for i in range(len(input_line)-1):
    if input_line[i]=="?":
        if i==0:
            if input_line[i+1]=="D":
                results.append("P")
            elif input_line[i+1]=="P":
                results.append("D")
            elif input_line[i+1]=="?":
                results.append("P")
        else:
            if results[i-1]=="P":
                results.append("D")
            elif results[i-1]=="D" and input_line[i+1]=="D":
                results.append("P")
            elif results[i-1]=="D" and input_line[i+1]=="P":
                results.append("D")
            elif input_line[i+1]=="P":
                results.append("D")
            elif input_line[i+1]=="D":
                results.append("P")
            elif input_line[i+1]=="?":
                results.append("P")
    else:
        results.append(input_line[i])

if input_line[-1]=="P":
    results.append(input_line[-1])
elif input_line[-1]=="D":
    results.append(input_line[-1])
elif input_line[-1]=="?":
    results.append("D")

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

Solution (Python):
t = input()

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

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  








T = read()[:-1]
print(T.replace('?', 'D'))

Solution (Python):
import copy
T = list(input())
P = [0]*(len(T)+10)
P[0] = 0
if T[0] == '?':
    T[0] = 'D'
for i in range(len(T)):
    if T[i] == '?':
        if T[i-1] == 'D':
            T[i] = 'D'
            P[i+1] = P[i] + 1
        else:
            T[i] = 'D'
            P[i+1] = P[i] + 2
    else:
        if T[i] == 'D':
            if T[i-1] == 'D':
                P[i+1] += P[i]+1
            else:
                P[i+1] = P[i]+2
        else: 
            P[i+1] = P[i]   


print(''.join(T))

Solution (Python):
a=input()

a=list(a)

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

b=""
for i in range(len(a)):
	b+=a[i]

print(b)

Solution (Python):
import sys
import math


input = sys.stdin.readline
 

def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))



x=insr()

for c in x:
	if c=='?':
		print("D",end="")
	else:
		print(c,end="")

Solution (Python):

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



if __name__ == '__main__':
    main()

Solution (Python):
t = input()

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

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

Solution (Python):
S = input()
N = len(S)
ans = ""
flag = ""
ans2 = ""

if(N==1):
  if(S == "?"):
    print("D")
  else:
    print(S)
else:
  for i in range(N):
    if(S[i] == "?"):
      flag += "1"
      ans += "D"
    else:
      flag += "0"
      ans += S[i]
  for i in range(N):
    if(i==0):
      if(ans[i+1] == "D" and flag[i] == "1"):
        ans2 += "P"
      else:
        ans2 += ans[i]
    elif(i==N-1):
      ans2 += ans[i]
    else:
      if(ans2[i-1] == "D" and ans[i+1] == "D" and flag[i] == "1"):
        ans2 += "P"
      else:
        ans2 += ans[i]
  print(ans2)

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

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

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

Solution (Python):
T = list(str(input()))
X = ''
for i in range(len(T)):
    if T[i] == 'P' :
        X += 'P'
    elif T[i] == 'D' :
        X += 'D'
    elif T[i] == '?' :
        if T[i-1] == 'D' :
            X += 'D'
        elif T[i-1] == 'P' :
            X += 'D'
        elif T[i-1] == '?':
            X += 'D' 
            
print(X)

Solution (Python):
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    T = input().strip()
    res = ""
    for t in T:
        if t == "?":
            t = "D"
        res += t

    print(res)


if __name__ == "__main__":
    main()

Solution (Python):
t = input()

list_t = list(t)

n = len(list_t)

for i in range(n):
    if n == 1:
        list_t[i] = 'D'
        break
    if list_t[i] == '?':
        if i > 0 and i < n - 1:
            if list_t[i - 1] == 'P' and list_t[i + 1] == 'P':
                list_t[i] = 'D'
            if list_t[i - 1] == 'P' and list_t[i + 1] == 'D':
                list_t[i] = 'D'
            if list_t[i - 1] == 'P' and list_t[i + 1] == '?':
                list_t[i] = 'D'
            if list_t[i - 1] == 'D' and list_t[i + 1] == 'P':
                list_t[i] = 'D'
            if list_t[i - 1] == 'D' and list_t[i + 1] == 'D':
                list_t[i] = 'P'
            if list_t[i - 1] == 'D' and list_t[i + 1] == '?':
                list_t[i] = 'P'
        elif i > 0:
            if list_t[i - 1] == 'P':
                list_t[i] = 'D'
            if list_t[i - 1] == 'D':
                list_t[i] = 'D'
        elif i < n - 1:
            if list_t[i + 1] == 'P':
                list_t[i] = 'D'
            if list_t[i + 1] == 'D':
                list_t[i] = 'P'
            if list_t[i + 1] == '?':
                list_t[i] = 'D'


print(''.join(list_t))

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

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

Solution (Python):
import numpy as np

input_str  = list(input())
count = 0



if len(input_str) == 1:
    input_str[0] = 'D'
else:
    if input_str[0] == '?':
        if input_str[1] == 'P':
            input_str[0] = 'D'
        else:
            input_str[0] = 'P'

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

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

ans = ''.join(input_str)

print(ans)

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

Solution (Python):
w = input()
while "?" in w:
	p = w.rfind("?")
	try:
		if w[p+1] == "D":
			w = w.replace("?", "P", 1)
		else:
			w = w.replace("?", "D", 1)
	except IndexError:
		w = w.replace("?", "D", 1)
print(w)

Solution (Python):

if __name__ == "__main__":
    t = input()
    result = ""
    pre_c = ""
    for curr_c in t:
        if curr_c == "?":
            curr_c = "D"
        result += curr_c
        pre_c = curr_c
    print(result)

Solution (Python):
t = input()
ans = []
for i, s in enumerate(t):
    if s == '?':
        ans.append('D')
    else:
        ans.append(s)

for s in ans:
    print(s, end='')
print('')

Solution (Python):
T=list(input())
l=len(T)
S=[]
for i in range(l-1):
  if T[i]=="P" or T[i]=="D":
    S.append(T[i])
  if T[i]=="?":
    S.append("D")
      
if T[l-1]=="P" or T[l-1]=="D":
  S.append(T[l-1])
if T[l-1]=="?":
  S.append("D")

P=''.join(S)
print(P)

Solution (Python):
import collections
a=input()
b=a.replace('?','D')
print(b)

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

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

print("".join(data))

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

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

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

Solution (Python):
T = input()

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

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

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

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


for index, PD in enumerate(PDList):
    if PD != '?': continue

    if PD == '?' and len(PDList) == 1:
        PDList[index] = 'D'
        break

    if index == 0:
        if PDList[index + 1] == 'D' or PDList[index + 1] == '?': PDList[index] = 'P'
        else: PDList[index] = 'D'
        continue

    if PD == '?' and index == len(PDList) - 1:
        PDList[index] = 'D'
        continue


    if PDList[index - 1] == 'P':
        PDList[index] = 'D'
        continue

    if PDList[index + 1] == 'D':
        PDList[index] = 'P'
        continue

    if PDList[index - 1] == 'D' and PDList[index + 1] == '?':
        PDList[index] = 'P'
        continue


    PDList[index] = 'D'
    continue


print(''.join(PDList))

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

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

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

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

Solution (Python):
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

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

Solution (Python):
T = input()

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

print(T)

Solution (Python):
s = input()
r1 = s.replace('?','D').count('D') + s.replace('?','D').count('PD')
r2 = s.replace('?','P').count('D') + s.replace('?','P').count('PD')
if r1 >= r2:
    print(s.replace('?','D'))
else:
    print(s.replace('?','P'))

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

main()

Solution (Python):
pd = list(map(str,input()))

if(len(pd) == 1):
    pd[0] ="D"
else:
    if(pd[0] == "?"):
            pd[0] = "D"
    for i in range(1,len(pd)):
        if(pd[i]=="?"):
            pd[i] = "D"
print("".join(pd))

Solution (Python):
T = input()

tmp = []
for i in T:
    tmp.append(i)
    
import sys
    
if len(T) == 1:
    if T[0] == '?':
        print('D')
    else:
        print(T)
    sys.exit()
    
for i in range(len(tmp)):
    if tmp[i] == '?':
        tmp[i] = 'D'
        
print(''.join(tmp))

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

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

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

if len(T) > 1:
    if T[-1] == "?":
        ans += "D"
    else:
        ans += T[-1]
            
print(ans)

Solution (Python):
T = input()

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

Solution (Python):
s = input().split()
s_replace = [x.replace('?', 'D') for x in s]
print(s_replace[0])

Solution (Python):
def main():
    t = list(input())
    pre_char = "*" 
    answer_char_lst = []
    for i in range(len(t)):
        temp_c = t[i]
        next_c = t[i+1] if i < len(t)-1 else "P"
        pre_c = t[i-1] if i > 0 else "D"

        if temp_c == "?":
            if pre_c == "P":
                temp_c = "D"
            elif pre_c == "D":
                temp_c = "P" if next_c == "D" else "D"
            else:
                temp_c = "D"
        t[i] = temp_c
        answer_char_lst.append(temp_c)

    print("".join(answer_char_lst))


if __name__ == '__main__':
    main()

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

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

Solution (Python):
s = input()

for idx in range(len(s)):
    if s[idx] == '?':
        print('D', end='')
    else:
        print(s[idx], end='')

print()

Solution (Python):
from collections import deque
T = input().rstrip()
d = deque()
d.extend(list(T))
answer = deque()
window = deque(maxlen=3)
for a in d:
    if a == '?':
        answer.append('D')
    else:
        answer.append(a)
print(''.join(answer))

Solution (Python):
T = input()

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

Solution (Python):
S = input()

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

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

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

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

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

ans = ""

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

print(ans)

Solution (Python):
t = input()

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

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

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

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

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

Solution (Python):
T=input()
ans=''
i=0
N=len(T)
if N==1 and T=='?':
  print('D')
  exit(0)
while i<N:
  if T[i]!='?':
    ans=ans+T[i]
  else:
    if i>0 and i<N-1:
      if ans[-1]=='P':
        ans=ans+'D'
      elif ans[-1]=='D' and T[i+1]=='D':
        ans=ans+'P'
      elif ans[-1]=='D' and T[i+1]=='P':
        ans=ans+'D'
      elif ans[-1]=='D' and T[i+1]=='?':
        ans=ans+'PD'
        i+=1
    elif i==0:
      if T[i+1]=='D':
        ans=ans+'P'
      elif T[i+1]=='?':
        ans=ans+'PD'
        i+=1
      else:
        ans=ans+'D'
    elif i==N-1:
      ans=ans+'D'

        
  i+=1
print(ans)

Solution (Python):
import os
import sys
from io import BytesIO, IOBase


def main():
    text = list(input())
    for pos in range(len(text)-1):
        if text[pos] == 'P'and text[pos+1] == '?':
            text[pos+1] = 'D'
        if text[pos] == '?':
            if text[pos+1] == '?':
                text[pos] = 'P'
                text[pos+1] = 'D'
            elif text[pos+1] == 'D':
                text[pos] = 'P'
            else:
                text[pos] = 'D'
    if text[-1] == '?':
        text[-1] = 'D'
    text = ''.join(text)
    print(text)



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)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()

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

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

Solution (Python):
def main():
    t = input()
    if t == '?':
        return 'D'
    n = len(t)
    ans = list(t)
    for i, c in enumerate(t):
        if c == '?':
            if i == 0:
                if t[i+1] == 'P':
                    s = 'D'
                else:
                    s = 'P'
            elif i == n-1:
                s = 'D'
            else:
                if ans[i-1] == 'D' and t[i+1] == 'P':
                    s = 'D'
                elif ans[i-1] == 'D' and t[i+1] == 'D':
                    s = 'P'
                elif ans[i-1] == 'P' and t[i+1] == 'P':
                    s = 'D'
                elif ans[i-1] == 'P' and t[i+1] == 'D':
                    s = 'D'
                elif ans[i-1] == 'P' and t[i+1] == '?':
                    s = 'D'
                elif ans[i-1] == 'D' and t[i+1] == '?':
                    s = 'P'
        else:
            s = c
        ans[i] = s
    return ''.join(ans)

print(main())

Solution (Python):
T = input()

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

print(ans)