結果

問題 No.436 ccw
ユーザー willowoooo
提出日時 2016-11-05 00:18:08
言語 Java
(openjdk 23)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 3,471 ms
コンパイル使用メモリ 75,060 KB
実行使用メモリ 55,984 KB
最終ジャッジ日時 2024-11-25 03:00:31
合計ジャッジ時間 8,293 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

package test;

import java.util.Arrays;
import java.util.Scanner;

public class No436 {
	void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int c = 0,w = 0;
		for(char x:s.toCharArray()){
			if(x == 'c'){
				c++;
			}
			else{
				w++;
			}
		}
		if(c - 1 >= w)
			System.out.println(w);
		else {
			System.out.println(c-1);
		}

	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new No436().run();
	}
}
0