結果
| 問題 |
No.430 文字列検索
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-11 01:39:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 234 ms / 2,000 ms |
| コード長 | 1,025 bytes |
| コンパイル時間 | 232 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 139,972 KB |
| 最終ジャッジ日時 | 2024-11-10 01:00:27 |
| 合計ジャッジ時間 | 2,722 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 |
ソースコード
import math
import sys
import heapq
from collections import deque
sys.setrecursionlimit(500*500)
stdin = sys.stdin
def YES(): print('Yes')
def NO(): print('No')
def TAKAHASHI(): print('Takahashi')
def AOKI(): print("Aoki")
def ns(): return stdin.readline().strip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))
def nz(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def nm(n): return [na() for _ in range(n)]
MOD = int(1e9+7)
def YES():
print('Yes')
def NO():
print('No')
def TAKAHASHI():
print('Takahashi')
def AOKI():
print("Aoki")
s = ns()
M = ni()
s_set = [set()]*11
ans = 0
ord_a = ord('A')
def o(s):
return ord(s)-ord_a
table = {}
for i in range(10):
for j in range(len(s)-i):
if s[j:j+i+1] in table:
table[s[j:j+i+1]] += 1
else:
table[s[j:j+i+1]] = 1
for i in range(M):
c = ns()
lc = len(c)
hc = 0
hs = 0
if c in table:
ans += table[c]
print(ans)