結果

問題 No.345 最小チワワ問題
ユーザー shinwisteriashinwisteria
提出日時 2017-04-02 23:40:27
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 3,527 ms
コンパイル使用メモリ 71,820 KB
実行使用メモリ 58,140 KB
最終ジャッジ日時 2023-09-22 07:51:26
合計ジャッジ時間 8,672 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,764 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 117 ms
56,052 KB
testcase_08 AC 118 ms
55,496 KB
testcase_09 AC 118 ms
55,424 KB
testcase_10 AC 117 ms
55,952 KB
testcase_11 AC 118 ms
55,920 KB
testcase_12 AC 120 ms
56,148 KB
testcase_13 AC 120 ms
55,720 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 119 ms
56,308 KB
testcase_21 AC 118 ms
56,068 KB
testcase_22 AC 119 ms
55,924 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 118 ms
55,544 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 117 ms
55,788 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].{0,}[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