Question: You are given a string 5 (of length n) consisting of alphabets only. You need to perform m queries on the string. In each query,

 You are given a string 5 (of length n) consisting ofalphabets only. You need to perform m queries on the string. In

You are given a string 5 (of length n) consisting of alphabets only. You need to perform m queries on the string. In each query, there will be one of the two types of operations. They are as follow. Operation Description Constraints 1 x ch Change the xth character of Stoch (ie. S[x] = ch). 1sxsn, 'a's chs 'z 2 LR ch Count the number of occurrences of ch between indices Land Rin S. That means, you have to count number of such indices i where s[i] == LSSRLSRST, 'a'sch sz ch Input The first line of the input contains two integers n (1 sns 105) and m (1 sms 5x105), the length of the string 5 and the number of queries respectively. The next line will contain the string 5. Each of the next mlines will contain any type of the two operations mentioned in the description. Output You don't need to print anything for the first type of query. Print the desired answer for the second type

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!