結果

問題 No.436 ccw
ユーザー iroha168
提出日時 2017-01-12 02:56:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 647 bytes
コンパイル時間 987 ms
コンパイル使用メモリ 89,360 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-21 10:01:38
合計ジャッジ時間 2,174 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
using namespace std;

int main() {
	string a;
	cin >> a;
	int m = a.length() / 2;
	if (a.length() % 2) m++;
	int c = 0, l =0;
	for (int i = 0; i < a.length(); i++) {
		if (a[i] == 'c' && a[i + 1] == 'c' && a[i+2] == 'w') {
			l = i+1;
		}
	}
	c = 0;
	int r = 0;
	for (int i = a.length() - 3; i >= 0; i--) {
		if (a[i] == 'c' && a[i + 1] == 'c' && a[i + 2] == 'w') {
			r = a.length() - i - 2;
		}
	}
	int mx = min(l, r);
	cout << mx << endl;
	return 0;
}
0