#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
#define int long long int
//#define ll long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define deb(x) cout << #x << " --> " << x << endl;
#define deb1a(v) cout << #v << "--->" << endl; for (auto it : v)  cout << it << " "; cout << endl;
#define deb2a(v) cout << #v << "--->" << endl;for (auto it:v){for(auto it1 : it){cout << it1 << " ";}cout<< endl;}
#define deb3a(v) cout << #v << "-->" << endl; for(auto it:v){cout << it.fi << " " << it.se << endl;}
#define mod 998244353
#define so(v) sort(v.begin(),v.end())
#define fi first
#define se second
#define db1(x) cout<<#x<<"="<<x<<endl
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<endl
int power(int x, unsigned int y, int p){ int res = 1;x = x % p;while (y > 0)  { if (y & 1)res = (res*x) % p;y = y>>1;  x = (x*x)% p;} return res;}
int mI(int a, int m)  {return power(a, m - 2, m);}
// vector<vector<int>> dir = {{1, 0}, {-1, 0}, {0, 1}, {0, -1},{1,1},{1,-1},{-1,1},{-1,-1}};
#define double long double
vec v;
int n;
int dp[200001][4];
int fun(int in,int last){
    if(in>=n){
        return 0;
    }
    int cc = 0;
    if(dp[in][last]!=-1){
        return dp[in][last];
    }
    if(v[in]!=-1){
        if(v[in]==1){
            cc++;
            if(last==0){
                cc++;
            }
        }
        return dp[in][last]= cc+fun(in + 1, v[in]);
    }
    else{
        int ans = 0;
        ans = fun(in + 1, 0);
        if(last==0){
            ans = max(ans, 2 + fun(in + 1, 1));
        }
        else{
            ans = max(ans, 1 + fun(in + 1, 1));
        }
    return dp[in][last]= ans;
    }
    return 0;
}
vec anss;
void fun1(int in,int last){
    if(in>=n){
        return;
    }
    int cc = 0;
    if(v[in]!=-1){
        if(v[in]==1){
            cc++;
            if(last==0){
                cc++;
            }
        }
        anss.pb(v[in]);
        return fun1(in + 1, v[in]);
    }
    else{
        int ans = 0;
        int cc=0, la=0,ans1;
        ans = fun(in + 1, 0);
        if(last==0){
            ans1 = ans;
            ans = max(ans, 2 + fun(in + 1, 1));
            if(ans1!=ans){
                cc = 2, la = 1;
            }
        }
        else{
            ans1 = ans;
            ans = max(ans, 1 + fun(in + 1, 1));
            if(ans1!=ans){
                cc = 1, la = 1;
            }
        }
        anss.pb(la);
        return fun1(in + 1, la);
    }
    
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    n = s.size();
    v.resize(s.size());
    fo(i,s.size()){
        if(s[i]=='P'){
            v[i] = 0;
        }
        else if(s[i]=='D'){
            v[i] = 1;
        }
        else{
            v[i] = -1;
        }
    }
    memset(dp, -1, sizeof(dp));
    //deb(fun(0, 2));
    fun1(0, 2);
    fo(i,n){
        if(anss[i]==1){
            cout << 'D';
        }
        else{
            cout << 'P';
        }
    }
}


Measured memory_bytes: 25828