結果

問題 No.345 最小チワワ問題
ユーザー shinwisteria
提出日時 2017-04-02 23:42:45
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 3,160 ms
コンパイル使用メモリ 75,012 KB
実行使用メモリ 54,588 KB
最終ジャッジ日時 2024-07-08 00:20:11
合計ジャッジ時間 6,975 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます

ソースコード

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