You are viewing a single comment's thread. Return to all comments →
from collections import defaultdict if __name__ == '__main__': n = int(input().strip()) _map=defaultdict(int) for n_itr in range(n): first_multiple_input = input().rstrip().split() op = first_multiple_input[0] contact = first_multiple_input[1] if op=='add': if len(contact)>0: for i in range(len(contact)+1): _map[contact[:i]]+=1 else: print(_map.get(contact, 0))
Seems like cookies are disabled on this browser, please enable them to open this website
Tries: Contacts
You are viewing a single comment's thread. Return to all comments →