結果

問題 No.279 木の数え上げ
ユーザー koko_u
提出日時 2015-10-04 23:21:06
言語 Java
(openjdk 23)
結果
AC  
実行時間 266 ms / 2,000 ms
コード長 808 bytes
コンパイル時間 2,454 ms
コンパイル使用メモリ 86,084 KB
実行使用メモリ 57,600 KB
最終ジャッジ日時 2024-10-14 15:15:14
合計ジャッジ時間 7,203 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

package jp.co.kokou.sample.no279;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {
        try (InputStreamReader isr = new InputStreamReader(System.in);
             BufferedReader br = new BufferedReader(isr)) {

            String line = br.readLine();
            long tCount = charCount('t', line);
            long rCount = charCount('r', line);
            long eCount = charCount('e', line) / 2;

            long max = Math.min(Math.min(tCount, rCount), eCount);

            System.out.format("%d%n", max);
        } catch (IOException ex) {

        }
    }

    private static long charCount(char c, String seq) {
        return seq.chars().filter(i -> i == (int) c).count();
    }
}
0