結果

問題 No.1005 BOT対策
ユーザー s_shohei
提出日時 2020-04-11 14:37:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 82,180 KB
実行使用メモリ 53,776 KB
最終ジャッジ日時 2025-06-20 00:52:12
合計ジャッジ時間 2,768 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

s=input()
t=input()

if len(t)==1 and s.count(t)>0:
    print(-1)
    exit()

t_now=0
ans=0
for i in range(len(s)):
    if s[i] == t[t_now]:
        if t_now+1 == len(t):
            ans+=1
            if t[-1] == t[0]:
                t_now=1
            else:
                t_now=0
        else:
            t_now+=1
    elif s[i] == t[0]:
        t_now=1
    else:
        t_now=0
print(ans)
0