結果

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

ソースコード

diff #

#include <iostream>
using namespace std;

string yuki = "yukicoder";

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    int c = 0;
    for (int i = 0; i < n - yuki.size() + 1; i++)
    {
        if (s.substr(i, (int)yuki.size()) == yuki)
        {
            c++;
            i += yuki.size() - 1;
        }
        else
        {
            c = 0;
        }
        ans = max(ans, c);
    }
    cout << ans << endl;
}
0