結果

問題 No.8116 TCP ソート
ユーザー Maeda
提出日時 2025-08-28 13:11:48
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 2,669 ms
コンパイル使用メモリ 77,808 KB
実行使用メモリ 46,544 KB
最終ジャッジ日時 2025-08-28 13:11:56
合計ジャッジ時間 7,209 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String n = scan.nextLine();
		int[] countTCP = new int[3];
		
		for(int i = 0 ; i < n.length() ; i++){
			if(n.charAt(i) == 'T'){
				countTCP[0]++;
			}else if(n.charAt(i) == 'C'){
				countTCP[1]++;
			}else{
				countTCP[2]++;
			}
		}
		String ans = "";
		for(int i = 0 ; i < 3 ; i++){
			for(int j = 0 ; j < countTCP[i] ; j++){
				if(i == 0){
					ans += "T";
				}else if(i == 1){
					ans += "C";
				}else{
					ans += "P";
				}
			}
		}
		System.out.println(ans);
    }
}
0