using namespace std; #define maxn 3000
int main() { int check[4]={0},mark=0; char b[4]={'G','P','L','T'}; string s;cin >>s; transform(s.begin(),s.end(),s.begin(),::toupper); for (int i = 0; i < s.size(); i++) for (int k = 0; k <= 3; k++) if(s[i] == b[k]) check[k]++; for (int i = 0; i <= 3; i++)if(check[i]) mark++; while(mark) { for (int i = 0; i <= 3; i++) if(check[i]) { check[i]--; cout<<b[i]; if(check[i] == 0) mark--; } } return 0; }