# Q.2                                                                                                                                                                                                             
T=readline()
#println("Input: ",split(tmp))                                                                                                                                                                                    

#println(parse.(Int64,split(tmp)))                                                                                                                                                                                

#println("Input: $T")                                                                                                                                                                                             
#println("Input: ",length(T))                                                                                                                                                                                     
#println("typeof each args... ",typeof(T))                                                                                                                                                                        

function calc_score(T)
    function calc(str,score)
        let i = 1
            while i < length(T)
                if findnext(str,T,i) !== nothing
                    score += 1
                    i = findnext(str,T,i)[1]+1
                else
                    i = length(T)
                end
            end
        end
        score
    end
    score = calc("PD",0)
    calc("D",score)
end

#ps = calc_score(T)                                                                                                                                                                                               
#each = split.(T,"")                                                                                                                                                                                              
#println(each)                                                                                                                                                                                                    

#=for chr in each                                                                                                                                                                                                 
    if chr == "?"                                                                                                                                                                                                 
        chr = "D"                                                                                                                                                                                                 
#        calc_score(T)                                                                                                                                                                                            
    end                                                                                                                                                                                                           
end                                                                                                                                                                                                               
=#
TC = replace.(T,["?"=>"D"])
#println(TC)                                                                                                                                                                                                      
#println(calc_score(TC[1]))                                                                                                                                                                                       

ans = TC[1]
println(ans)

Measured memory_bytes: 174792