#include using namespace std; #define all(x) begin(x), end(x) #ifdef CKISEKI #include #define safe cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n" #define debug(a...) debug_(#a, a) #define orange(a...) orange_(#a, a) void debug_(auto s, auto ...a) { cerr << "\e[1;32m(" << s << ") = ("; int f = 0; (..., (cerr << (f++ ? ", " : "") << a)); cerr << ")\e[0m\n"; } void orange_(auto s, auto L, auto R) { cerr << "\e[1;33m[ " << s << " ] = [ "; using namespace experimental; copy(L, R, make_ostream_joiner(cerr, ", ")); cerr << " ]\e[0m\n"; } #else #define safe ((void)0) #define debug(...) safe #define orange(...) safe #endif signed main() { cin.tie(nullptr)->sync_with_stdio(false); string S; cin >> S; if (S.find('C') == string::npos) { sort(all(S)); } else { int rk[256] = {}; rk['T'] = 0; rk['C'] = 1; rk['P'] = 2; sort(all(S), [rk](char a, char b) { return rk[a] < rk[b]; }); } cout << S << '\n'; }