結果

問題 No.2298 yukicounter
ユーザー furon
提出日時 2023-05-12 21:48:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 1,374 bytes
コンパイル時間 957 ms
コンパイル使用メモリ 121,632 KB
最終ジャッジ日時 2025-02-12 22:30:34
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <queue>
#include <map>
#include <bitset>
#include <set>
#include <stack>
#include <numeric>
#include <unordered_map>
#include <random>

using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vd = vector<double>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vpii = vector<pii>;
using vpll = vector<pll>;
using vpdd = vector<pdd>;
const int inf = (1 << 30) - 1;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
//const int MOD = 998244353;

int main() {
	string s;
	cin >> s;
	string t = "yukicoder";
	int ans = 0;
	string tmp = "";
	for (int i = 0; i < s.length() - 8; i++) {
		if (s[i] == 'y') {
			bool ok = true;
			for (int j = 1; j < 9; j++) {
				if (s[i + j] != t[j]) {
					ok = false;
					tmp += 'y';
					break;
				};
			}
			if (ok) {
				tmp += '0';
				i += 8;
			}
		}
		else {
			tmp += s[i];
		}
	}
	int cnt = 0;
	for (int i = 0; i < tmp.length(); i++) {
		if (tmp[i] == '0') cnt++;
		else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}
	ans = max(ans, cnt);
	cout << ans << endl;

	return 0;
}
0