We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
importre# Enter your code here. Read input from STDIN. Print output to STDOUTn=int(input())ifnot(1<=n<=100):raiseValueError("Number of lines must be between 1 and 100")lines=[]foriinrange(n):lines.append(input())q=int(input())ifnot(1<=q<=100):raiseValueError("Queries must be between 1 and 10")queries=[]foriinrange(q):queries.append(input())# print(n)# print(lines)# print(q)# print(queries)patterns=[]forqueryinqueries:pattern='[A-Za-z0-9_]'+query+'[A-Za-z0-9_]'patterns.append(pattern)sum=0forpatteninpatterns:forlineinlines:x=re.findall(patten,line)sum=sum+len(x)print(sum)sum=0
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Find A Sub-Word
You are viewing a single comment's thread. Return to all comments →
Pthon code: