結果

問題 No.436 ccw
ユーザー dogwood0424dogwood0424
提出日時 2017-12-04 00:44:20
言語 Java19
(openjdk 21)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 2,884 ms
コンパイル使用メモリ 72,368 KB
実行使用メモリ 56,964 KB
最終ジャッジ日時 2023-08-19 02:19:29
合計ジャッジ時間 7,167 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
55,892 KB
testcase_01 AC 100 ms
56,380 KB
testcase_02 AC 97 ms
56,004 KB
testcase_03 AC 98 ms
55,964 KB
testcase_04 AC 100 ms
55,652 KB
testcase_05 AC 100 ms
56,312 KB
testcase_06 AC 101 ms
55,704 KB
testcase_07 AC 98 ms
56,080 KB
testcase_08 AC 99 ms
55,872 KB
testcase_09 AC 97 ms
56,260 KB
testcase_10 AC 97 ms
56,032 KB
testcase_11 AC 97 ms
55,800 KB
testcase_12 AC 99 ms
56,084 KB
testcase_13 AC 99 ms
55,864 KB
testcase_14 AC 101 ms
56,532 KB
testcase_15 AC 99 ms
56,436 KB
testcase_16 AC 109 ms
56,152 KB
testcase_17 AC 105 ms
56,256 KB
testcase_18 AC 110 ms
55,976 KB
testcase_19 AC 117 ms
56,032 KB
testcase_20 AC 111 ms
56,112 KB
testcase_21 AC 157 ms
56,964 KB
testcase_22 AC 164 ms
56,660 KB
testcase_23 AC 157 ms
56,140 KB
testcase_24 AC 164 ms
56,116 KB
testcase_25 AC 164 ms
56,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No436 {

	static int search(String S,char c){
		int cnt=0;

		for(char x:S.toCharArray()) {
			if(x==c)
			{
				cnt++;}
			}
		return cnt;
		}

	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		int C,W;

		C = search(S,'c');
		W = search(S,'w');

		System.out.println(Math.min(C-1,W));

	}

}
0