結果

問題 No.436 ccw
ユーザー samplelpmassamplelpmas
提出日時 2017-01-14 17:50:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 3,350 ms
コンパイル使用メモリ 71,664 KB
実行使用メモリ 56,952 KB
最終ジャッジ日時 2023-08-23 10:36:42
合計ジャッジ時間 7,021 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,756 KB
testcase_01 AC 115 ms
55,896 KB
testcase_02 AC 114 ms
55,724 KB
testcase_03 AC 117 ms
55,592 KB
testcase_04 AC 115 ms
55,436 KB
testcase_05 AC 115 ms
55,860 KB
testcase_06 AC 118 ms
55,616 KB
testcase_07 AC 116 ms
55,460 KB
testcase_08 AC 114 ms
55,632 KB
testcase_09 AC 115 ms
55,388 KB
testcase_10 AC 118 ms
55,596 KB
testcase_11 AC 117 ms
55,416 KB
testcase_12 AC 123 ms
55,612 KB
testcase_13 AC 118 ms
55,984 KB
testcase_14 AC 116 ms
55,776 KB
testcase_15 AC 115 ms
55,780 KB
testcase_16 AC 128 ms
53,972 KB
testcase_17 AC 122 ms
55,768 KB
testcase_18 AC 128 ms
55,780 KB
testcase_19 AC 129 ms
55,892 KB
testcase_20 AC 132 ms
56,052 KB
testcase_21 AC 189 ms
56,056 KB
testcase_22 AC 187 ms
56,952 KB
testcase_23 AC 187 ms
56,552 KB
testcase_24 AC 194 ms
56,580 KB
testcase_25 AC 192 ms
56,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String ccwString = sc.next();

        int cCount = 0;
        int wCount = 0;

        for (int i = 0; i < ccwString.length(); i++) {

            char ch = ccwString.charAt(i);

            if (ch == 'c') {
                cCount++;
            }

            if (ch == 'w') {
                wCount++;
            }

        }

        System.out.println(Math.min(cCount - 1, wCount));

    }

}
0