#ifdef NACHIA #define _GLIBCXX_DEBUG #else #define NDEBUG #endif #include #include #include #include using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(i64 i=0; i void chmin(A& l, const A& r){ if(r < l) l = r; } template void chmax(A& l, const A& r){ if(l < r) l = r; } using namespace std; void testcase(){ string S; cin >> S; i64 cnt[3] = {}; string PCT = "TCP"; for(char c : S) cnt[PCT.find(c)] += 1; if(cnt[1] == 0){ cout << string(cnt[2], PCT[2]); cout << string(cnt[1], PCT[1]); } else { rep(s,3) cout << string(cnt[s], PCT[s]); } cout << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); rep(t,3) testcase(); return 0; }