結果

問題 No.8116 TCP ソート
ユーザー すや
提出日時 2025-04-03 22:42:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 194,236 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-04-03 22:42:55
合計ジャッジ時間 3,273 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
	int t=0,c=0,p=0;
	string s;cin>>s;
	for(auto& i:s){
		if(i=='T')t++;
		if(i=='C')c++;
		if(i=='P')p++;
	}
	if(c){
        while(t--)cout<<"T";
	    while(c--)cout<<"C";
	    while(p--)cout<<"P";
    }else{
        while(p--)cout<<"P";
        while(t--)cout<<"T";
    }
	cout<<'\n';
}
0