結果
| 問題 | 
                            No.1005 BOT対策
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-03-06 21:52:57 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 586 bytes | 
| コンパイル時間 | 1,451 ms | 
| コンパイル使用メモリ | 167,528 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-14 10:34:33 | 
| 合計ジャッジ時間 | 2,686 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 RE * 3 | 
ソースコード
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int main() {
    string S, T;
    cin >> S >> T;
    if (T.size() == 1) {
        rep(i, S.size()) {
            if (S[i] == T[0]) {
                cout << "-1\n";
                return 0;
            }
        }
        cout << "0\n";
        return 0;
    }
    int ans = 0;
    rep(i, S.size() - T.size() + 1) {
        if (S.substr(i, T.size()) == T) {
            ans++;
            i = i + T.size() - 2;
        }
    }
    cout << ans << endl;
}