結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const int siz = 9;
const string yuki = "yukicoder";

int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> loc;
  for (int i = 0; i <= n - siz; i++) {
    string t = s.substr(i, siz);
    if (t == yuki) {
      loc.push_back(i);
    }
  }
  int pre = 1e8;
  int cont = 0, ans = 0;
  for (int x : loc) {
    if (x - pre == siz) {
      cont++;
    } else {
      cont = 1;
    }
    ans = max(ans, cont);
    pre = x;
  }
  cout << ans << endl;
}
0