結果

問題 No.430 文字列検索
ユーザー ebicochineal
提出日時 2016-10-22 00:50:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 894 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-10 00:11:18
合計ジャッジ時間 7,484 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#! /usr/bin/env python3

def f(s, t):
    p = 0
    cnt = 0
    while 1:
        p = s.find(t)
        if p >= 0:
            cnt += 1
            s = s[p+1:]
        else:
            break
    return cnt

def main():
    s = input()
    n = int(input())
    print(sum(f(s, input()) for _ in range(n)))
    
if __name__ == '__main__':
    main()
0