結果

問題 No.430 文字列検索
ユーザー vwxyz
提出日時 2023-08-10 09:55:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 164,096 KB
最終ジャッジ日時 2024-11-10 01:06:57
合計ジャッジ時間 2,542 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline
from collections import defaultdict

S=readline().rstrip()
N=len(S)
cnt=defaultdict(int)
for le in range(1,11):
    for i in range(N-le+1):
        cnt[S[i:i+le]]+=1
M=int(readline())
ans=0
for m in range(M):
    C=readline().rstrip()
    ans+=cnt[C]
print(ans)
0