結果

問題 No.436 ccw
ユーザー dogwood0424
提出日時 2017-12-04 00:44:20
言語 Java
(openjdk 23)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 3,467 ms
コンパイル使用メモリ 74,980 KB
実行使用メモリ 54,456 KB
最終ジャッジ日時 2024-11-28 15:04:30
合計ジャッジ時間 7,809 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

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