結果

問題 No.8116 TCP ソート
コンテスト
ユーザー sgtshr1022
提出日時 2025-12-31 12:20:17
言語 C++23
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,255 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,616 ms
コンパイル使用メモリ 278,620 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-12-31 12:20:22
合計ジャッジ時間 3,739 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define rep1(a)          for (int i = 0; i < (a); i++)
#define rep2(i, a)       for (int i = 0; i < (a); i++)
#define rep3(i, a, b)    for (int i = a; i < (b); i++)
#define rep4(i, a, b, c) for (int i = a; i < (b); i += c)
#define overload4(a, b, c, d, e, ...) e
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
using ll = long long;
constexpr ll INF = (1LL << 60);
void chmax(ll& a, ll b) { a = max(a, b);}
void chmin(ll& a, ll b) { a = min(a, b); }
inline void YesNo(bool ok) {
  cout << (ok ? "Yes\n" : "No\n");
}
template<class T>
void input_vec(vector<T>& v) {
  for (auto& x : v) cin >> x;
}
template<class... T>
void input(T&... a) {
  (cin >> ... >> a);
}
void print() {
  cout << '\n';
}
template<class T, class... Ts>
void print(const T& a, const Ts&... b) {
  cout << a;
  (cout << ... << (cout << ' ', b));
  cout << '\n';
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int t=0, c=0, p=0;
  for (auto x : s) {
	if (x=='T') t++;
	if (x=='C') c++;
	if (x=='P') p++;
  }
  if (c==0) {
	  cout << string(p,'P')<<string(t,'T') << endl;
	  return 0;
  }
  cout <<string(t,'T')<<string(c,'C')<<string(p,'P')<< '\n';
  return 0;
}
0