結果

問題 No.436 ccw
ユーザー matsuyoshi30matsuyoshi30
提出日時 2017-03-29 21:36:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 525 bytes
コンパイル時間 1,879 ms
コンパイル使用メモリ 72,796 KB
実行使用メモリ 58,348 KB
最終ジャッジ日時 2023-09-20 20:19:40
合計ジャッジ時間 6,337 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
55,388 KB
testcase_01 AC 112 ms
55,568 KB
testcase_02 AC 111 ms
56,172 KB
testcase_03 AC 110 ms
55,808 KB
testcase_04 AC 112 ms
55,932 KB
testcase_05 AC 108 ms
55,644 KB
testcase_06 AC 111 ms
55,952 KB
testcase_07 AC 112 ms
56,176 KB
testcase_08 AC 111 ms
56,068 KB
testcase_09 AC 111 ms
56,004 KB
testcase_10 AC 112 ms
55,656 KB
testcase_11 AC 112 ms
56,104 KB
testcase_12 AC 111 ms
55,844 KB
testcase_13 AC 112 ms
56,232 KB
testcase_14 AC 109 ms
56,132 KB
testcase_15 AC 112 ms
56,620 KB
testcase_16 AC 128 ms
56,604 KB
testcase_17 AC 122 ms
56,004 KB
testcase_18 AC 128 ms
56,040 KB
testcase_19 AC 130 ms
56,488 KB
testcase_20 AC 130 ms
56,312 KB
testcase_21 AC 194 ms
56,348 KB
testcase_22 AC 190 ms
56,644 KB
testcase_23 AC 188 ms
56,732 KB
testcase_24 AC 193 ms
58,348 KB
testcase_25 AC 188 ms
56,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        char[] c = s.toCharArray();

        int c_l = 0;
        int w_l = 0;
        for(int i=0; i<s.length(); i++) {
            if(c[i] == 'c') c_l++;
            if(c[i] == 'w') w_l++;
        }

        System.out.println(Math.min(c_l - 1, w_l));

        in.close();
    }
}
0