#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;
}