#include #include using namespace std; using ll = long long; string S; int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> S; bool f = false; for(char c : S)if(c == 'C')f = true; sort(S.begin(), S.end(), [](char a, char b){ if(a == 'T' && b == 'C'){ return 1; } if(a == 'C' && b == 'P'){ return 1; } if(a == 'T' && b == 'P'){ return 1; } return 0; }); if(f){ cout << S << endl; }else{ reverse(S.begin(), S.end()); cout << S << endl; } return 0; }