結果

問題 No.1005 BOT対策
ユーザー lice6613
提出日時 2020-04-26 20:53:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 2,265 ms
コンパイル使用メモリ 193,836 KB
最終ジャッジ日時 2025-01-10 02:22:38
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  string S, T;
  cin >> S >> T;
  int ans = 0;
  for (size_t i = 0; i <= S.size() - T.size(); ++i) {
    if (S.size() < T.size()) {
      break;
    }

    if (S.substr(i, T.size()) == T) {
      ++ans;
      for (size_t j = i; j < i + T.size(); ++j) {
        S[j] = ' ';
      }
    }
  }
  if (T.size() == 1 && ans != 0) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}
0