結果

問題 No.279 木の数え上げ
ユーザー Grenache
提出日時 2015-09-18 22:23:46
言語 Java
(openjdk 23)
結果
AC  
実行時間 302 ms / 2,000 ms
コード長 630 bytes
コンパイル時間 3,730 ms
コンパイル使用メモリ 76,204 KB
実行使用メモリ 49,092 KB
最終ジャッジ日時 2024-09-26 12:34:42
合計ジャッジ時間 8,829 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder279 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        char[] s = sc.next().toCharArray();
        int[] cnt = new int[3];

        for (int i = 0; i < s.length; i++) {
        	if (s[i] == 't') {
        		cnt[0]++;
        	} else if (s[i] == 'r') {
        		cnt[1]++;
        	} else if (s[i] == 'e') {
        		cnt[2]++;
        	}
        }

        int ret = cnt[0];
        ret = Math.min(ret, cnt[1]);
        ret = Math.min(ret, cnt[2] / 2);
        
        System.out.println(ret);

        sc.close();
    }
}
0