結果

問題 No.1005 BOT対策
コンテスト
ユーザー lemon
提出日時 2021-05-02 17:28:01
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 557 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 878 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2026-04-03 03:08:45
合計ジャッジ時間 7,627 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys, collections
 
sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

s = input()
t = input()

ans = s.count(t)

if ans:
    if len(t) == 1:
        ans = -1
    
    else:
        ls = len(s)
        lt = len(t)
        ans = 0
        i = 0
        j = i + lt
        while j <= ls:
            if s[i:j] == t:
                ans += 1
                i = j
            else:
                i += 1

            j = i + lt

print(ans)
0