#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin>>s;
int x=0;
int y=0;
for(int i=0; i<s.length(); i++){
if(s[i]=='G')
y++;
if(s[i]=='D')
y--;
if(s[i]=='P')
x++;
if(s[i]=='L')
x--;
}
if(y>0){
while(y--)
cout<<"D";
}
else if(y<0){
while(y++)
cout<<"G";
}
if(x>0){
while(x--)
cout<<"L";
}
else if(x<0){
while(x++)
cout<<"P";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CnN0cmluZyBzOwpjaW4+PnM7CmludCB4PTA7CmludCB5PTA7CmZvcihpbnQgaT0wOyBpPHMubGVuZ3RoKCk7IGkrKyl7CglpZihzW2ldPT0nRycpCgl5Kys7CglpZihzW2ldPT0nRCcpCgl5LS07CglpZihzW2ldPT0nUCcpCgl4Kys7CglpZihzW2ldPT0nTCcpCgl4LS07Cn0KCmlmKHk+MCl7Cgl3aGlsZSh5LS0pCgljb3V0PDwiRCI7Cn0KZWxzZSBpZih5PDApewoJd2hpbGUoeSsrKQoJY291dDw8IkciOwp9CmlmKHg+MCl7Cgl3aGlsZSh4LS0pCgljb3V0PDwiTCI7Cn0KCmVsc2UgaWYoeDwwKXsKCXdoaWxlKHgrKykKCWNvdXQ8PCJQIjsKfQoJcmV0dXJuIDA7Cn0=