peterverebics/CodeNet_Python_118 huggingface dataset:
h1, m1, h2, m2, k = map(int, input().split())
h = h2-h1
m = m2-m1
a = h*60
m += a
b = k
if k != m:
    while k+b != m and k+b < m:
        if k+b == m:
            k = 0
            break
        k += b
else:
    k = 0
print(k)
import sys
h1 = sys.stdin.readline()
m1 = sys.stdin.readline()
h2 = sys.stdin.readline()
m2 = sys.stdin.readline()
k = sys.stdin.readline()
h1, m1, h2, m2, k = map(int,input().split())
x = 60*max(0, h2-h1-1)
print(x)
if h1 == h2:
    x += (m2-m1)
else:
    x += (60-m1 + m2)
print(x - k)
hmk = input('')

h1 = int(hmk.split(' ')[0])
m1 = int(hmk.split(' ')[1])
h2 = int(hmk.split(' ')[2])
m2 = int(hmk.split(' ')[3])
k = int(hmk.split(' ')[4])

h = h2 - h1
m = m2 - m1
if h < 0:
    h = 24 - h1 + h2
if m < 0:
    m = m1 - m2
    h-=1

a = h*60 + m - k
print(a)
H1,M1,H2,M2,K = map(int, input().split())
mm = M2 - M1
hh = H2 - H1
M = hh*60 + mm
print((M//K-1)*K)
H1,M1,H2,M2,K = map(int,input().split())
print(60*H2 + M2 - (60*H1 + M2) - K)
h1, m1, h2, m2, k = map(int,input().split())

h=h2 - h1
if h < 0:
    h = 24+h
m=m2 - m1

du=h*60+m - 0.5

print(int((du//k)*k))
H1, M1, H2, M2, K = map(int, input().split())


if H2 > H1:
    print((H2 * 60) +  M2 - (H1 * 60) + M1 - K)
else:
    print(((H2 + 24) * 60) +  M2 - (H1 * 60) + M1 - K)
H1, H2, H3, H4, K = map(int, input().split())
up = H1*60+H2
down = H3*60-H4
print(down-up-K)
H1, M1, H2, M2, K = map(int,input().split())

if H2 <= H1:
    print(0)

time2m = H2 * 60 + M2
time1m = H1 * 60 + M1

study_time = time2m - K - time1m

if study_time <= 0:
    print(0)
else:
    print(study_time)
H1, M1, H2, M2, K = map(int, input().split())

if H1 > H2 or (H1 == H2 and M1 >= M2):
    H2 += 24
    
diff_min = H2*60 + M2 - (H1*60 + M1)
if diff_min - K < 0:
    print(0)
else:
    diff_min - K
H1, M1, H2, M2, K = map(int,input().split())

wake = H1 * 60 + M1
sleep = H2 * 60 + M2
ans = 0
if wake <= sleep:
    time = sleep - wake
    while time > K:
        time -= K
        ans += K
else:
    time = 24 * 60
    time -= wake - sleep
    while time > 0:
        time -= K
        ans += K

print(ans)
h1, m1, h2, m2, k = map(int, input().split())


if m1 > m2:
    h = h2 - h1 - 1
    m = 60 - m1 - m2
else:
    h = h2 - h1
    m = m2 - m1

print(h*60 + m - k)
H1, M1, H2, M2, K = map(int, input().split())

time = 60*H2+M2 - 60*H1+M1

print(max(time-K, 0))
h1, m1, h2, m2, k = list(map(int, input().split()))
if m1 < m2:
    h1 -= m2/60
    m1 += m2/60
tm = m1 - m2
th = h2 - h1
if tm < k and th > 0:
    h1 -= k/60
    m1 += k/60
elif tm < k and th < 0:
  th, th = 0, 0 
tm -= k
print(th*60 + tm)
import sys
input = sys.stdin.readline

a,b,c,d,e = map(int,input().split())
minites = c*60+d - a*60 + b 
if minites < 0:
  print(60*24 +minites -e)
else:
  print(minites -e)
H = input().split()
sdy =0
if int(H[2]) >= int(H[0]):
  sdy = int(H[2])*60 +int(H[3])-int(H[0])*60 +int(H[1]) - int(H[4])
else:
  H[2] = (int(H[2])+24)
  sdy = int(H[2])*60 +int(H[3])-int(H[0])*60 +int(H[1]) - int(H[4])
if int(sdy) < 0:
  sdy = 0
print(sdy)
import datetime

def main():
    H1, M1, H2, M2, K = input().split()
    dt1 = datetime.datetime.strptime(H1+M1, '%H%M')
    dt2 = datetime.datetime.strptime(H2+M2, '%H%M')
    if dt1 < dt2:
        ans = int((dt2-dt1).total_seconds() // 60)
    else:
        ans = 24 * 60 - int(abs((dt2-dt1).total_seconds()) // 60)
    print(ans - int(K))



if __name__ == "__main__":
    main()
H1,M1,H2,M2,K = map(int, input().split())
H = max(H2,H1) - min(H1,H2)
M = max(M1,M2) - min(M1,M2)
if H*60+M > K:
    print(H*60+M-K)
else:
    print(0)
h1,m1,h2,m2,k = map(int,input().split())
if m2 < m1:
	m2 += 60
if m2 < m1:
    h2 -= 1
m = m2-m1
h = h2-h1
print(60*h+m-k)
h1 , m1 , h2 , m2 , k = map(int, input().split())

h = h2 - h1
m = abs(m1-m2)

print(h*60+m-k)
h1, m1, h2, m2, k = map(int, input().split())
h = h2-h1
if m1 > m2:
    m2 += 60
m = m2-m1
a = h*60
m += a
b = k
print(m)
if k != m:
    while k+b != m and k+b < m:
        if k+b == m:
            k = 0
            break
        k += b
else:
    k = 0
print(k)
h1, m1, h2, m2, k = map(int, input().split())

hour = (h2-h1)
minu = (abs(m2-m1))

time = hour * 60 + minu - k

if(time >= 0):
  print(time)
else:
  print("0")
h1, m1, h2, m2, k = map(int, input().split())

h = h2 - h1
m = m2 - m1

if m < 0:
    h -= 1
    m = 60 - m2 + m1

ans = 60*h + m - k
if ans < 0:
    ans = 0
print(ans)
h1, m1, h2, m2, k = map(int, input().split())
h = (h2 - h1) % 24
m = (m2 - m1) % 60

print(h*60 + m - k)
import datetime

h1,m1,h2,m2,k=map(int, input().split())

starttime = datetime.datetime(2020, 1, 1, h1, m1)
endtime = datetime.datetime(2020, 1, 1, h2, m2) - datetime.timedelta(minutes = k)

td = endtime-starttime
ans = td.seconds / 60
if ans <= 0:
    ans = 0
print(ans)
t=input()
result=''
for i in range(len(t)-1):
    if t[i]=='?':
        try:
            if result[i-1]=='P':
                result+='D'
            else:
                result+='P'
        except:
            if  t[i+1]=='P':
                result+='D'
            else:
                result+='P'
    else:
        result+=t[i]
print(result+'D')
h1, m1, h2, m2, k = map(int, input().split())		# 5 7 2

dm = (h2*60+m2) - (h1*60+m1) - 1

ans = max(0, dm // k) * k
print(ans)
abc = [int(e) for e in input().split()]

H1 = abc[0]
M1 = abc[1]
H2 = abc[2]
M2 = abc[3]
K = abc[4]

start_time = H1*60 + M1
end_time = H2*60 + M2
if end_time > start_time:
    valid_time = end_time - start_time
elif start_time > end_time:
    valid_time = (end_time+24*60) - start_time
else:
    valid_time = 0

if valid_time % K == 0:
    valid_time = valid_time - 1

execution_time = valid_time // K

ans = execution_time * K

print(int(ans))
h_1, m_1, h_2, m_2, k = map(int, input().split())
print(h_1*60+m_1-h_2*60-m_2-k)
h1, m1, h2, m2, k = map(int, input().split())
t1 = 60 * h1 + m1
t2 = 60 * h2 * m2
print(t2 - t1 - k)
H1, M1, H2, M2, K = list(map(int, input().split()))
time = (H2 - H1) * 60 + M2 - M1
study = 0
while study + K < time:
    study += K
print(study)
h1, m1, h2, m2, k = map(int, input().split())
 
time = h2 * 60 + m2 - h1 * 60 + m1
if k >= time:
    print(1)
else:
    print(time - k)
import sys
input = sys.stdin.readline

t = input()
t_update = t[0]
for i in t[1:]:
    if i == "?":
        i = "D"
    t_update += i
print(t_update)
h1,m1,h2,m2,k = map(int,input().split())

hm1 = (h1+m1)*60
hm2 = (h2+m2)*60

t = hm2 - k

ans = t - hm1

print(ans)
#!/usr/bin/env pypy3

import math

h1, m1, h2, m2, k = map(int, input().split())

if h1 > h2:
    h2 += 24
if m2 > m1:
    m2 += 60

allMin = (h2 - h1)*60 + (m2 - m1) - k

print(allMin)
h1, m1, h2, m2, k = map(int, input().split())

time1 = h1*60 + m1
time2 = h2*60 - m2

a = (time2 - time1 -2) // k
b = (time2 - time1 -2) % k

if a == 0:
    ans = 0
else:
    ans = a * k

print(ans)
H1, M1, H2, M2, K = map(int, input().rstrip().split())
minutes = M2 - M1
hours = 0
if minutes < 0:
    minutes += 60
    hours += 1
hours = H2 - H1
minutes += hours*60
print(minutes-K)
h1, m1,h2,m2,k = map(int,input().split())
print((h2*60+m2 - h1*60+m1)-k)
"""
H1時M1分起床
H2時M2分就寝
K分勉強
"""
 
H1, M1, H2, M2, K = [int(i) for i in input().split(" ")]

awake_time = H1 *60 + M1
sleep_time = H2 *60 + M1
start_limit_time = sleep_time - K
 
can_study_time = start_limit_time - awake_time
 
print(can_study_time)
#A - Study Scheduling

def answ():
    h1, m1, h2,m2,k = map(int, input().split())
    h = h2 - h1
    m = m2 - m1
    if m < 0:
        m = m + 60
        h = h - 1
    time = h*60 + m 
    return time - k
answ()
H1,M1,H2,M2,K = map(int,input().split())

h = H2 - H1
m = M2 - M1
s = 0
if h > 0:
    s = h * 60 + m
elif h == 0:
    s = 24 * 60 + m
elif h < 0:
    s = (24 + h) * 60 + m

# print(s)
if s - K > 0:
    s = s - K
else:
    s = 0
print(s)
h1, m1, h2, m2, k = list(map(int, input().split()))

time = (h2 - h1) * 60 + abs(m1 - m2) - k

print(time)
h1,m1,h2,m2,k = map(int,input().split())
h = h2 - h1
m = m2 - m1
if m < 0:
    h -= 1
    m = 60 + m
time = h * 60 + m
ans = time // k
ans *= k
print(ans - k)
H1, M1, H2, M2, K = map(int, input().split())
m = (H2 * 60 + M2) - (H1 * 60 - M1)
print(m - K)
H_1,M_1,H_2,M_2,K = map(int,input().split())
if H_2 < H_1:
    H_2 += 24
MaxH = abs(H_2 - H_1)
if M_1 >= M_2:
    MaxM = M_2 - M_1
if M_1 < M_2:
    MaxM = M_1 - M_2
useTime = MaxH*60 + MaxM
useTime -= K
print(useTime)
H1,M1,H2,M2,K = map(int,input().split())

h = H2 - H1
m = M2 - M1
s = 0
if h > 0:
    s = h * 60 + m
elif h == 0:
    s = 24 * 60 + m
elif h < 0:
    s = (24 + h) * 60 + m


# if s - K > 0:
s -= K
# else:
#     s = 0
print(s)
h1, m1, h2, m2, k = map(int, input().split())

time = (h2 - h1) * 60 + (m2 - m1) - 1

import math

try:
    print(math.floor(time // k) * k)
except ZeroDivisionError:
    print(0)
num_list = list(map(int, input().split())) 

a=num_list[2]-num_list[0]
b=num_list[3]-num_list[1]
if b<0:
    a=a-1
a=a*60
c=b+a-num_list[4]
if c<0:
    c=0
print(c)
H1,M1,H2,M2,K = map(int,input().split())

if (M1 < M2):
  H = H2 - H1 - 1
  M = M1 - M2
  if M < 0:
    M = 60 - M
    
else:
  H = H2 - H1
  M = M2 - M1

T = H * 60 + M

print(T)

if T > K:
  print(T - K)
else:
  print("0")
x = list(map(int, input().split()))
h = (x[2] - x[0])*60
if x[2] != x[0]:
    m = abs(x[1] - x[3])
else:
    m= 0
ans = max(m+h-x[-1], 0)
print(ans)
#デフォルト
import itertools
from collections import defaultdict
import collections
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

h1, m1, h2, m2, k = map(int, input().split())

minute = ((h2 * 60) + m2) - (h1 * 60) + m1

print(max(0, (minute - k)))
H = input().split()
if H[0] > H[2]:
  H[2] = int(H[2])+24
sdy =0
sdy = int(H[2])*60 +int(H[3])-int(H[0])*60 +int(H[1]) - int(H[4])
print(sdy)
L=list(map(int,input().split()))
if L[0] > L[2]:
	A=60*L[0]+L[1]
	B=60*(L[2]+24)+L[3]
else:
	A=60*L[0]+L[1]
	B=60*L[2]+L[3]

if B-A <= L[4]:
	print("0")
elif (B-A)%L[4]==0:
	print(str(((B-A)-L[4])))
else:
	print(str(round((B-A)//L[4])))
from math import *
from sys import stdin,stdout
input=stdin.buffer.readline

ip=[int(x) for x in input().split()]
h1=ip[0]
m1=ip[1]
h2=ip[2]
m2=ip[3]
k=ip[4]

time=(h2*60+m2-1)-(h1*60+m1+1)
x=time//k
if(k*x<0):
	print(0)
else:
	print(k*x)
h1, m1, h2, m2, k = map(int,input().split())

h=h2 - h1
if h < 0:
    h = 24+h
m=m2 - m1

du=h*60+m 

print(int((du//k)*k))
h1,m1,h2,m2,k = map(int,input().split())
 
#print(h1,m1,h2,m2,k)
t = 0
if m1 > m2:
    t =(h2-h1-1)*60+m1-m2-k
else:
    t =(h2-h1)*60+m1-m2-k

if t > 0:
    print(t)
else:
    print(0)
h1, m1, h2, m2, k = map(int, input().split())
pos = 60 * (h2 - h1) + abs(m2 - m1)
print(max(0, pos - k))
H = list(map(int,input().split()))

h = H[2]-H[0]
m = H[3]-H[1]

if h < 0:
    h = h + 24

if m < 0:
    h -= 1
    m *= -1

mini = h*60 + m - H[4]

if mini < 0:
    mini = 24*60 -mini

print(mini)
h1,m1,h2,m2,k = map(int,input().split())
h = h2 - h1
m = m2 - m1
print((60*h-m)-k)
def resolve():
    h1, m1, h2, m2, k = list(map(int, input().split()))

    t1 = h1*60 + m1
    t2 = h2*60 + m2

    print(t2 - t1 - k)
#resolve()
h1, m1, h2, m2, k = map(int, input().split())

high = max(h1 * 60 + m1, h2 * 60 - m2)
low = min(h1 * 60 + m1, h2 * 60 - m2)
print(max(high - low - k, 0))
h1,m1,h2,m2,k=map(int,input().split())
tot=0
if m2>=m1:
	tot+=(m2-m1)+60*(h2-h1)
else:
	h2=h2-1
	m2+=60+m2
	tot+=(h2-h1)*60+(m2-m1)
print(tot-k)
h1,m1,h2,m2,k=map(int,input().split())

h1_m = h1 + m1/60
h2_m = h2 + m2/60

h = h2_m-h1_m

print(int(h*60-k))
maxcount = -1
maxt = ''

def a(t):
  global maxcount
  global maxt
  j = t.find('?')
  if j == -1:
    n = t.count('PD') + t.count('D')
    if n > maxcount:
      maxcount = n
      maxt = t
  else:
    t = t[:j] + 'P' + t[j+1:]
    pc = a(t)
    t = t[:j] + 'D' + t[j+1:]
    dc = a(t)

t = input()
a(t)
print(maxt)
import datetime

def main():
    H1, M1, H2, M2, K = input().split()
    dt1 = datetime.datetime.strptime(H1+M1, '%H%M')
    input_time1 = dt1.time()
    dt2 = datetime.datetime.strptime(H2+M2, '%H%M')
    input_time2 = dt2.time()
    ans = int((dt2-dt1).total_seconds() // 60)
    if ans - int(K) >= 0:
        print(ans - int(K))
    else:
        print(0)



if __name__ == "__main__":
    main()
h1,m1,h2,m2,k = map(int,input().split())

m = m2-m1 + (h2-h1)*60 -1
print(m//k * k)
#!/usr/bin/env python3
a, b, c, d, k = map(int, input().split())
print((((c - a) * 60 + (d - b)) // k - 1) * k)
H1, M1, H2, M2, K = map(int,input().split())

latest = H2*60+M2-K  #[min]
earliest = H1*60

study = abs(latest-earliest)
print(study)
h1, m1, h2, m2, k = map(int, input().split())
h_time = h2 - h1
if m1 < m2:
    h_time -= 1
    m_time = 60 - m2 + m1
else:
    m_time = m2 - m1

study_time = (h_time * 60 + m_time) - k
if study_time <= 0:
    print(0)
else:
    print(study_time)
HM = list(map(int, input().split()))
hours = HM[2]-HM[0]
minutes = HM[3]-HM[1]
K = HM[4]
totalTimes = hours*60+minutes
minusCount = 0
if totalTimes%K == 0:
  print(totalTimes-K)
else:
  while totalTimes > K:
    totalTimes = totalTimes-K
    minusCount+=1
  print(K*minusCount)
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum


def çözmek():
    h, m, H, M, K = map(int, input().split(" "))
    res = (H * 60) + M - K - (h * 60) + m
    print(res)
if __name__ == "__main__":
    çözmek()
h1, m1, h2, m2, k = map(int, input().split())

hour = (h2-h1)
minu = (abs(m2-m1))

print(hour * 60 + minu - k)
h1, m1, h2, m2, k = map(int, input().split())

ans = (h2 - h1) * 60 - (m2 -m1) - k
print(ans)
h1, m1, h2, m2, k = map(int, input().split())

diff = (h2-h1)*60 + (m2-m1)

print(k*(diff//k-1))
from sys import stdin

h1, m1, h2, m2, k = [int(x) for x in stdin.readline().rstrip().split()]

allMin1 = h1 * 60
allMin2 = h2 * 60



diff = (allMin2 - allMin1)
sec = m2 - m1

diff -= sec

if diff < 0 :
	diff += 24 * 60

ans = diff - k

if ans >= 0 :
	print(ans)
else :
	print(0)
h,m,h2,m2,k=map(int,input().split())
print(h2*60+m-h*60+m-k)
h1, m1, h2, m2, k = map(int,input().split())
x = 60*max(0, h2-h1-1)
x += (60-m1 + m2 - 1)
print(x // k * k)
h1, m1, h2, m2, k = map(int,input().split())
#print(h1, m1, h2, m2, k)


time = h2*60+m2 - (h1*60+m2)
print(time-k)
a, b, c, d, k = map(int, input().split());

x = 60*a + b
y = 60*c + b

print(y-x-k);
H1, M1, H2, M2, K = map(int, input().split())

H = H2 - H1
M = M2 - M1

M = abs(M2 - M1)

answer = H*60 + M - K
print(answer)
n = list(map(int,input().split()))

start = n[0]*60 + n[1]
end = n[2]*60 + n[3]

zikan = end - start -1
kai = zikan // n[4] * n[4]
print(kai)
import numpy as np
h1, m1, h2, m2, k = np.array(list(map(int, input().split())))
h = h2 - h1
m = m2-m1
t = h*60 + m
print(t)
def main():
    h1,m1,h2,m2,k = map(int, input().split())
    x = (60*h2+m2)-(60*h1+m1)-1
    print(int(k*int(x/k)))

main()
h,m,a,b,k=map(int,input().split())
h1 = 12 - h
a1 = a - 12
sub =( h1 + a1 )*60
print(sub-k)
h, m, H, M, k = map(int, input().split())

mini = (60-m)+M
if h < H:
    hour = (H-h-1)*60
else:
    hour = (24-(h-H)-1)*60

print(hour+mini-k)
h1 , m1 , h2 , m2 , k = map(int , input().split())
diff1 = (h1)*60 + m1
diff2 = h2*60 + m2
diff = diff1-diff2
ans = diff - k
#print(diff1,diff2,diff,ans)
if ans <=0:
	print(0)
else:
	print(ans)
h, m, H, M, K = map(int, input().split())

if M >= m :
    k = (H - h) * 60
    k += M - m
    
else :
    k = (h - h - 1) * 60
    k += 60 - m
    k += M
    
if k - K <= 0 :
    print(0)
else :
    print(k - K)
h1,m1,h2,m2,k=map(int,input().split())
if(h1==h2):
    print(m2-m1-k)
elif(m1<m2):
    print((h2-h1)*60+(60-m1)+m2-k)
else:
    print((h2-h1)*60+(m2-m1)-k)
H1, M1, H2, M2, K = map(int, input().split())
print((H2 - H1) * 60 - K)
T = input()
ans = []
for i in range(len(T)):
    if T[i] == "?":
        ans.append("D")
    else:
        ans.append(T[i])
print(*ans,sep="")
s = input()
s = list(str(s))

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

print(''.join(s))
t=list(input())
for i in range(len(t)):
    if t[i]=='?':
        t[i]='D'
print(''.join(t))
T = list(input())
ans = 0
i = 0
while i < len(T):
  if T[i] == "?":
    T[i] = "D"
  i += 1
print("".join(T))
#-*-coding:utf-8-*-

import sys

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

if __name__ == "__main__":
    main()
if __name__ == "__main__":
    print(input().replace('?', 'D'))
#!/usr/bin/env python3

T = list(input())

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

print(''.join(T))
line = list(input())
N = len(line)
i = 1
for i in range(N):
    if line[i] == "?":
        line[i] = "D"
print("".join(line))
T = list(input())
for i in range(len(T)):
    if T[i] == "?":
        T[i] = "D"
print("".join(T))
T = list(input())
if len(T) == 1:
  if T[0] == "?":
    print("D")
  else:
    print("".join(T))
else:
  for i in range(len(T)):
    if i > 0 and T[i] == "?" and T[i-1] == "P":
      T[i] = "D"
    elif i < len(T) -1 and T[i] == "?" and (T[i+1] == "D" or T[i+1] == "?"):
      T[i] = "P"
    elif T[i] == "?":
      T[i] = "D"
  print("".join(T))
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))
t=list(input())
pre_p=False
for i,tt in enumerate(t):
  if tt == 'P':
    pre_p=True
  elif tt == 'D':
    pre_p=False
  elif pre_p:
    t[i] = 'D'
  elif i < len(t)-1:
    if t[i+1] == 'D':
      t[i] = 'P'
    else:
      t[i] = 'D'
  else:
    t[i] = 'D'
    
print(''.join(t))
T = str(input())
A = T.replace('?','D')
print(A)
def main():
    T = list(input())
    for i in range(len(T)):
        if T[i] == '?':
            T[i] = 'D'

    print(''.join(T))

if __name__ == "__main__":
    main()
n = input()

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

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

print( n)
t = input()
t = t.replace("P?", "PD")
t = t.replace("?", "D")
print(t)
from sys import stdin
import math
a=stdin.readline()

for k in range(0,len(a)):
    if a[k]=='?':
        print('D',end='')
    else:
        print(a[k],end='')
t = input()
n = len(t)
ans = [None]*n
for i in range(n):
  if t[i] != "?":
    ans[i] = t[i]
  else:
    ans[i] = "D"

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

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

print(ans)
#B
T=input()
ans=T.replace("?", "D")
 
print(ans)
pd = list(input())
for i in range(len(pd)):
    if '?' in pd[i]:
        pd[i] = 'D'
    print(pd[i], end = '')
s = input()

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

print()
T=str(input())
ans=""
pre=False
for i in range(len(T)):
    if T[i]=="D":
        ans+=T[i]
        pre=False
    elif T[i]=="P":
        ans+=T[i]
        pre=True
    else:
        if pre==True:
            ans+="D"
            pre=False
        else:
            ans+="D"
print(ans)
T = list(input())
tlen = len(T)

for i in range(0, tlen):
  if T[i] == '?':
    T[i] = 'D'
    
print(*T,sep='')
#デフォルト
import itertools
from collections import defaultdict
import collections
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

t = list(input())

for i in range(len(t)):
    if (t[i] == "?"):
        print("D",end="")
    else:
        print(t[i],end="")
s = input().split()
s_replace = [x.replace('?', 'D') for x in s]
print(s_replace[0])
t = list(input())
for i in range(len(t)):
    if t[i] == "?":
        t[i] = "D"
print("".join(t))
t = input()
s = ""
for i in t:
    if i == "?":
        s+="D"
    else:
        s+=i
print(s)
t = list(input())

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

t = "".join(t)

print(t)
t = list(input())
for i in range(len(t)-1, -1, -1):
    if t[i] == '?':
        t[i] = 'D'
print(''.join(list(map(str, t))))
t = list(input())
ans =""
for i in t:
    if i == "?":
        ans += "D"
    else:
        ans += i
print(ans)
T = str(input())
N = len(T)
ans = [0] * N
for i in range(len(T)):
  if T[i] == "?":
    ans[i] = "D"
  else:
    ans[i] = T[i]

for i in range(N):
  print(ans[i], end = "")
t = list(input())
for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'
print(''.join(t))
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

t = ins()
s = t.replace('?','D')
print(s)
t = input()
ans = 0
for x in t:
    print('P' if x == 'P' else 'D', end = '')
print('')
T = input()
ans = T.replace('?', 'D')
print(ans)
def main():
    T = input()

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


if __name__ == "__main__":
    main()
T = input()
print(''.join(['D' if s=='?' else s for s in T]))
S = list(input().strip())
n = len(S)
for i in range(n):
    if S[i] == '?':
        S[i] = 'D'
print(''.join(S))
input1 = str(input())

temp = ""

for i in range(len(input1)):
    if input1[i] == "P":
        temp += "P"
    else:
        temp += "D"
        
print(temp)
t = input()
for i in range(len(t)):
    if t[i] == "?":
        print("D",end="")
    else:
        print(t[i],end="")
print()
t = input()
n = len(t)
ans = []
for i in range(n):
    if t[i] != "?":
        ans.append(t[i])
    else:
        ans.append("D")
print("".join(ans))
t = input()
t = t.replace('P?', 'PD').replace('?D', 'PD').replace('??', 'PD').replace('?', 'D')
print(t)
T = input()
rep = str(T).replace("?","D")
print(rep)
T = list(str(input()))

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

print(*T, sep="")
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 = "")
t = list(input())
ans = 0
for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'
print(''.join(t))
T = input()
for c in T:
    if c == '?':
        print('D', end='')
    else:
        print(c, end='')
print()
def main():
    T = input()
    print(T.replace('?','D'))



if __name__ == "__main__":
    main()
T = list(input())
for i in range(len(T)):
    if T[i] == '?':
        T[i] = 'D'
print(''.join(T))
a = input()
b = len(a)
c = []
for i in range(b):
    d = a[i]
    if d == '?':
        d='D'
    else:
        d = a[i]
    c.append(d)
print(''.join(c))
s = input()

s2 = s.replace('?','D')
print(s2)
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)
t = str(input())
res = ""
a = ""

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

print(res)
t = input()
t = [s for s in t]
for i in range(len(t)):
    if t[i]=='?':
        t[i] = 'D'
ans = ''.join(t)
print(ans)
T = input()
nt = ''
for i in T:
    if i =='?':
        i = 'D'
    nt+= i
    
print(nt)
T = input()
T = T.replace("?", "D")
print(T)
s=list(input())
for i in range(len(s)):
    if s[i]=='?':
        s[i]='D'
print(''.join(s))
b0=input()

st=""
for x in range(len(b0)):
  if b0[x]=="P":
    st=st+"P"
  else:
    st=st+"D"
    
print(st)
def resolve():
  T = input()
  print(T.replace('?', 'D'))

if __name__ == "__main__":
  resolve()
T = str(input())
ans = ""
for i in range(len(T)):
  if T[i] == "?":
    ans = ans + "D"
  else:
    ans = ans + T[i]
print(ans)
docs = [str(i) for i in input()]
res = [sub.replace('?', 'D') for sub in docs]
print(''.join(res))
def main():
    T = input()
    print(T.replace('?', 'D'))


if __name__ == "__main__":
    main()
T = input()
N = len(T)
res = []
for t in T:
    if t == "P":
        res.append("P")
    else:
        res.append("D")
print("".join(map(str, res)))
t = list(input())

for i in range(len(t)):
    if t[i] == "?":
        t[i] = 'D'
        
print(''.join(t))
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)
t = input()
u = []
for i in range(len(t)):
    if t[i] == '?':
        u.append('D')
    else:
        u.append(t[i])

u = ''.join(u)
print(u)
import numpy as np
import math
import collections

S = input()
print(S.replace("?", "D"))
t = input()
ans = ""
j = 0
for i in t:
    if i in ["?"]:
        ans += "D"
    else:
        ans += i
print(ans)