結果

問題 No.279 木の数え上げ
ユーザー YamaKasa
提出日時 2018-05-02 00:05:25
言語 Java
(openjdk 23)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 2,231 ms
コンパイル使用メモリ 74,752 KB
実行使用メモリ 45,804 KB
最終ジャッジ日時 2024-06-28 00:16:54
合計ジャッジ時間 6,542 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		int cnt1 = 0;
		int cnt2 = 0;
		int cnt3 = 0;
		for(int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if(c == 't') {
				cnt1 ++;
			}else if(c == 'r') {
				cnt2 ++;
			}else if(c == 'e') {
				cnt3 ++;
			}
		}
		int min = cnt1;
		if(cnt1 > cnt2) {
			min = cnt2;
		}
		if(min > cnt3 / 2) {
			min = cnt3 / 2;
		}
		System.out.println(min);
	}
}
0