結果
| 問題 | 
                            No.1005 BOT対策
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-08-18 10:45:49 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 397 bytes | 
| コンパイル時間 | 215 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 58,496 KB | 
| 最終ジャッジ日時 | 2024-10-05 22:26:17 | 
| 合計ジャッジ時間 | 2,097 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 23 WA * 4 | 
ソースコード
s = input()
t = input()
num = s.count(t)
if len(t) == 1 and num > 0:
    print(-1)
    exit()
tidx = 0
sidx = 0
ans = 0
for i in range(len(s)*2):
    if sidx >= len(s):
        break
    if s[sidx] == t[tidx]:
        if tidx == len(t)-1:
            ans += 1
            tidx = 0
        else:
            tidx += 1
            sidx += 1
    else:
        tidx = 0
        sidx += 1
print(ans)