結果

問題 No.1005 BOT対策
ユーザー lam6er
提出日時 2025-03-20 18:54:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,988 KB
実行使用メモリ 54,448 KB
最終ジャッジ日時 2025-03-20 18:56:26
合計ジャッジ時間 2,442 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input().strip()
T = input().strip()

m = len(T)
n = len(S)

matches = []

for i in range(n - m + 1):
    if S[i:i+m] == T:
        start = i
        end = i + m - 1
        matches.append((start, end))

if not matches:
    print(0)
else:
    matches.sort(key=lambda x: x[1])
    count = 0
    last = -1
    for s, e in matches:
        if s > last:
            count += 1
            last = e
    print(count)
0