DCP-329: String Frequency Query Back to All Problems

Easy Beginners Problems > Ad-hoc


You are given a string **S**, consisting of lowercase English alphabets, you have to perform following operations on it: 1 X Y : Change the character at index X to character Y 2 Y : Print the total number of occurrences of character Y in the string Input: ------ There will be only one input, which begins with string **S**. <br> Then there will be integer **Q** on the next line. <br> Then, following **Q** lines will contain query of either type 1 or type 2, begins with an integer denoting type of query.<br> if query is of type 1 followed by **space separated integer and character** , otherwise there will be **a single character**, as shown in above format.<br> See the sample Input/Output section for more details. Output: ------- For every query of ***type 2***, print an integer in a line denoting the **total number of character Y that occurs in current string.** Constraints: ------- **1<=|S|<=10^5,** |S| denotes length of string S. **1<=Q<=10^5** **0<=X<=( |S|-1 )**, indexing are 0-based. **'a'<=Y<='z'** Sample Input ------------ devskill 5 2 l 2 d 1 0 l 2 l 2 d Sample Output ------------- 2 1 3 0


Problem Setter:

Bishal Gautam

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 0.50
C++ 0.50
C++14 0.50
C# 1.00
Go 1.00
Java 1.00
JavaScript 1.00
Objective-C 1.00
Perl 1.00
PHP 1.00
Python 1.00
Python3 1.00
Ruby 1.00
VB.Net 1.00

Problem Stats

179/569

Solve/Submission

Ranking

# User Language Timing
01 Morass Cpp14 0.01s
02 souravahmed C 0.02s
03 prateepm Cpp14 0.02s
04 kissu_pari_na Cpp14 0.02s
05 rajdipsaha Cpp 0.02s
06 kazinayeem Cpp 0.02s
07 dipta007 Cpp14 0.02s
08 I_See_You Cpp14 0.02s
09 ssavi Cpp14 0.02s
10 skmonir Cpp14 0.02s
11 fsshakkhor Cpp14 0.02s
12 Optimus_primeV2 Cpp14 0.02s
13 Mahbub_Rahman Cpp 0.02s
14 emrul Cpp14 0.02s
15 MRITuhin Cpp14 0.02s
16 prodipdatta7 Cpp14 0.02s
17 kitorp Cpp14 0.02s
18 pulak_ict_mbstu Cpp 0.02s
19 afzalul C 0.02s
20 seyedssz Cpp14 0.02s
21 ovis96 Cpp14 0.02s
22 monir769 C 0.02s
23 nazmul_bzs Cpp14 0.03s
24 jayed_al_hasan Cpp14 0.03s
25 Ishraq_Nibir C 0.03s
26 moshiur_cse15 Cpp14 0.03s
27 feodorv C 0.03s
28 anik_JU Cpp14 0.03s
29 Reayz Cpp 0.03s
30 Bruteforceman Cpp14 0.03s
31 adamantium Cpp 0.03s
32 Fahim_Ahmed Cpp 0.03s
33 tariqiitju Cpp 0.03s
34 Nazmul_WUB Cpp 0.03s
35 nuhu_iu Cpp 0.03s
36 nasif2587 Cpp14 0.03s
37 Nirjhor Cpp14 0.03s
38 Koushik_12 Cpp 0.03s
39 Rajib_119 Cpp 0.03s
40 daihan_mbstu Cpp14 0.03s
41 FariD Cpp14 0.04s
42 sakib_ruet_13 Cpp 0.05s
43 Zeronfinity Cpp14 0.05s
44 Jakir_Hossain_Sust Cpp14 0.06s
45 ksohan Cpp 0.06s
46 indroneel Cpp14 0.06s
47 _dipu Cpp14 0.06s
48 Anonta Cpp14 0.06s
49 mir_lutfur_rahman Cpp14 0.07s
50 arafat_hasan Cpp 0.07s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support