結果

問題 No.436 ccw
ユーザー jimanojimano
提出日時 2018-02-10 17:14:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 498 bytes
コンパイル時間 4,806 ms
コンパイル使用メモリ 72,876 KB
実行使用メモリ 38,296 KB
最終ジャッジ日時 2024-04-22 17:59:00
合計ジャッジ時間 6,016 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
36,580 KB
testcase_01 AC 45 ms
36,956 KB
testcase_02 AC 45 ms
36,708 KB
testcase_03 AC 44 ms
36,700 KB
testcase_04 AC 45 ms
36,576 KB
testcase_05 AC 43 ms
36,580 KB
testcase_06 AC 46 ms
36,656 KB
testcase_07 AC 45 ms
36,508 KB
testcase_08 AC 46 ms
36,880 KB
testcase_09 AC 44 ms
36,764 KB
testcase_10 AC 45 ms
36,780 KB
testcase_11 AC 45 ms
36,832 KB
testcase_12 AC 45 ms
36,528 KB
testcase_13 AC 47 ms
36,832 KB
testcase_14 AC 45 ms
36,748 KB
testcase_15 AC 46 ms
36,832 KB
testcase_16 AC 46 ms
36,764 KB
testcase_17 AC 46 ms
36,896 KB
testcase_18 AC 46 ms
36,560 KB
testcase_19 AC 47 ms
36,932 KB
testcase_20 AC 47 ms
36,932 KB
testcase_21 AC 61 ms
38,296 KB
testcase_22 AC 60 ms
37,484 KB
testcase_23 AC 61 ms
37,508 KB
testcase_24 AC 60 ms
37,536 KB
testcase_25 AC 60 ms
37,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder;

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

public class No0436 {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] input = br.readLine().toCharArray();
		int cntC = 0;
		int cntW = 0;

		for (char c : input) {
			if (c == 'c') {
				cntC++;
			} else {
				cntW++;
			}
		}

		System.out.println(Math.min(cntC - 1, cntW));
	}
}
0