HackerRank-Regex-Solutions icon indicating copy to clipboard operation
HackerRank-Regex-Solutions copied to clipboard

Find a Sub-Word

Open MainakRepositor opened this issue 4 years ago • 0 comments

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)))

MainakRepositor avatar Nov 02 '21 14:11 MainakRepositor