結果

問題 No.436 ccw
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-05-18 23:43:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 303 ms / 2,000 ms
コード長 389 bytes
コンパイル時間 3,097 ms
コンパイル使用メモリ 72,140 KB
実行使用メモリ 64,284 KB
最終ジャッジ日時 2023-09-10 23:17:53
合計ジャッジ時間 8,742 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,792 KB
testcase_01 AC 121 ms
56,048 KB
testcase_02 AC 119 ms
55,748 KB
testcase_03 AC 120 ms
55,804 KB
testcase_04 AC 117 ms
55,844 KB
testcase_05 AC 120 ms
55,728 KB
testcase_06 AC 119 ms
56,080 KB
testcase_07 AC 118 ms
53,884 KB
testcase_08 AC 120 ms
54,220 KB
testcase_09 AC 124 ms
55,820 KB
testcase_10 AC 118 ms
55,668 KB
testcase_11 AC 121 ms
56,164 KB
testcase_12 AC 121 ms
56,148 KB
testcase_13 AC 119 ms
55,644 KB
testcase_14 AC 119 ms
55,980 KB
testcase_15 AC 125 ms
55,452 KB
testcase_16 AC 169 ms
55,956 KB
testcase_17 AC 141 ms
56,180 KB
testcase_18 AC 157 ms
56,024 KB
testcase_19 AC 166 ms
55,700 KB
testcase_20 AC 166 ms
55,812 KB
testcase_21 AC 303 ms
64,152 KB
testcase_22 AC 298 ms
59,796 KB
testcase_23 AC 290 ms
62,012 KB
testcase_24 AC 288 ms
64,284 KB
testcase_25 AC 286 ms
61,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No436{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String[] s = sc.nextLine().split("");
		
		int num_c = 0;
		int num_w = 0;
		for(int i = 0; i < s.length; i++){
			if(s[i].equals("c")) num_c++;
			else num_w++;
		}
		if(num_c-1 <= num_w) System.out.println(num_c-1);
		else System.out.println(num_w);
		
	}
}
0