結果

問題 No.436 ccw
ユーザー Daigo HIROOKA
提出日時 2018-05-18 23:43:15
言語 Java
(openjdk 23)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 389 bytes
コンパイル時間 3,290 ms
コンパイル使用メモリ 74,492 KB
実行使用メモリ 51,516 KB
最終ジャッジ日時 2024-06-28 14:04:32
合計ジャッジ時間 8,754 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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