結果

問題 No.1005 BOT対策
ユーザー lam6er
提出日時 2025-03-20 21:20:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,336 KB
実行使用メモリ 53,964 KB
最終ジャッジ日時 2025-03-20 21:21:48
合計ジャッジ時間 2,504 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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