結果

問題 No.1005 BOT対策
ユーザー hiragn
提出日時 2022-11-19 22:20:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2025-06-20 01:40:38
合計ジャッジ時間 2,045 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    s = input()
    t = input()

    if len(t) == 1:
        if t in s:
            exit(print(-1))
        else:
            exit(print(0))

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


if __name__ == "__main__":
    main()
0