You are viewing a single comment's thread. Return to all comments →
import re def statusCode(text): match = re.search(pattern, text) if(match !=None): if(match.group(1) == searchKey): print('0') elif(match.group(2) == searchKey): print('1') elif(match.group(3) == searchKey): print('2') else: print('-1') searchKey = 'hackerrank' pattern = r'(?:^({0})$|(^{0})|({0}$))'.format(searchKey) text = [statusCode(input()) for i in range(int(input()))]
Find HackerRank
You are viewing a single comment's thread. Return to all comments →