HackerRank-Regex-Solutions
HackerRank-Regex-Solutions copied to clipboard
Find a Sub-Word
import re
if name == 'main': n = int(input()) nline = '\n'.join(input() for _ in range(n))
q = int(input())
for _ in range(q):
s = input()
print(len(re.findall(r'\B(%s)\B' % s, nline)))