結果

問題 No.345 最小チワワ問題
ユーザー shinwisteriashinwisteria
提出日時 2017-04-02 23:42:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 3,626 ms
コンパイル使用メモリ 71,788 KB
実行使用メモリ 57,860 KB
最終ジャッジ日時 2023-09-22 07:52:23
合計ジャッジ時間 9,095 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,660 KB
testcase_01 AC 127 ms
55,652 KB
testcase_02 AC 127 ms
55,872 KB
testcase_03 AC 128 ms
55,760 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 125 ms
55,528 KB
testcase_08 AC 126 ms
55,276 KB
testcase_09 AC 126 ms
55,500 KB
testcase_10 AC 125 ms
55,704 KB
testcase_11 AC 125 ms
55,248 KB
testcase_12 AC 132 ms
55,572 KB
testcase_13 AC 126 ms
55,504 KB
testcase_14 WA -
testcase_15 AC 130 ms
55,564 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 127 ms
55,720 KB
testcase_20 AC 125 ms
55,376 KB
testcase_21 AC 125 ms
55,652 KB
testcase_22 AC 129 ms
55,724 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 126 ms
55,544 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 127 ms
55,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Mincww {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		String cww = s.next();
		s.close();
		String regex = "([c][^w]{0,}[w][^w]{0,}[w])";
		Pattern p = Pattern.compile(regex);
		Matcher m = p.matcher(cww);
		if(m.find()){
			System.out.println(m.group(1).length());
		}else{
			System.out.println("-1");
		}

	}

}
0