結果

問題 No.436 ccw
ユーザー htensaihtensai
提出日時 2019-11-19 13:15:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 2,208 ms
コンパイル使用メモリ 74,896 KB
実行使用メモリ 54,468 KB
最終ジャッジ日時 2024-04-14 09:25:14
合計ジャッジ時間 7,546 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
54,292 KB
testcase_01 AC 131 ms
54,448 KB
testcase_02 AC 134 ms
54,232 KB
testcase_03 AC 132 ms
54,020 KB
testcase_04 AC 133 ms
54,248 KB
testcase_05 AC 130 ms
54,404 KB
testcase_06 AC 134 ms
53,980 KB
testcase_07 AC 131 ms
54,128 KB
testcase_08 AC 130 ms
54,304 KB
testcase_09 AC 135 ms
53,904 KB
testcase_10 AC 140 ms
54,388 KB
testcase_11 AC 135 ms
54,252 KB
testcase_12 AC 136 ms
54,364 KB
testcase_13 AC 133 ms
53,856 KB
testcase_14 AC 130 ms
54,028 KB
testcase_15 AC 134 ms
53,980 KB
testcase_16 AC 150 ms
54,168 KB
testcase_17 AC 142 ms
54,124 KB
testcase_18 AC 146 ms
54,172 KB
testcase_19 AC 148 ms
54,468 KB
testcase_20 AC 147 ms
54,016 KB
testcase_21 AC 204 ms
54,400 KB
testcase_22 AC 198 ms
54,428 KB
testcase_23 AC 202 ms
54,444 KB
testcase_24 AC 201 ms
54,196 KB
testcase_25 AC 197 ms
54,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		int cCount = 0;
		int wCount = 0;
		for (int i = 0; i < arr.length; i++) {
		    if (arr[i] == 'c') {
		        cCount++;
		    } else {
		        wCount++;
		    }
		}
		int ans = Math.min(cCount - 1, wCount);
		System.out.println(ans);
	}
}
0