結果

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

ソースコード

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.substr(i, T.size()) == T) {
      ++ans;
      for (size_t j = i; j < i + T.size(); ++j) {
        S[j] = ' ';
      }
    }
  }
  
  if (T.size() == 1) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}
0