結果

問題 No.345 最小チワワ問題
ユーザー E31415926
提出日時 2016-03-29 21:02:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 447 bytes
コンパイル時間 4,356 ms
コンパイル使用メモリ 214,504 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-02 07:29:48
合計ジャッジ時間 5,329 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<regex>
using namespace std;

int main()
{
	string s;
	regex regex("c[^w]*w[^w]*w");
	smatch match;
	int min = 100;
	cin >> s;
	sregex_token_iterator first(begin(s),end(s), regex);
	sregex_token_iterator last;
	if (first == last) {
		cout << -1 << endl;
		return 0;
	}
	while (first != last) {
		if (first->length() < min) {
			min = first->length();
		}
		++first;
	}
	cout << min << endl;
	return 0;
}
0