Company: sprinklr_13july
Difficulty: medium
Search Engine Problem Description Prof. Arnab Bhattacharya has asked you to implement a basic search engine which gives you term frequencies for his Course Information Retrieval. This search engine will have these functionalities: Index i.e. store a given term & it's frequency Prefix query i.e. frequency of terms with given prefix (upto this point) Update i.e. update frequency of given term Input: First line: Integer `n` denoting number of operations. Next `n` lines containing space separated operation, string (say `op_i s_i f_i`) & integer only if it's index/update operation. Where `op_i` == 'Q' denotes prefix query. `op_i` == 'I' (capital i) denotes index operation. `op_i` == 'U' denotes update operation. `s_i` is string to be queried or indexed & `f_i` is frequency of terms (present only if `op_i`=='I' or `op_i`=='U'). Output: Term frequency for every prefix query in newline. Examples Example 1: Input: 6 I apple 2 I google 1 I sprinkle 10 I spring 2 Q apple Q spr Output: