COD love!! [Medium]
Practice
4.1 (7 votes)
Medium
Problem
72% Success 654 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Gurpreet and Shyamu were playing COD(yes you read right that is Call of Duty). As you all know Gurpreet is too good in it. Shyamu being jealous give Gurpreet a problem to solve so that he can clear more missions than him.
The Problem is :
Shyamu gives Gurpreet a string str and q queries.
Each query is of type

k ch
(where k is a positive number and ch is a lowercase character)

In each query Gurpreet has to delete kth occurence of character ch. And at the end he has to print the string after all queries. As Gurpreet wants to play COD he give this task to you to solve.

Input :

The first line contains string str, and second line contains q that is number of queries.
Then q lines consist of queries as above explained.

Output :

A String in single line after performing all queries.

Constraints :

1 <= length(str) <= 2*105
1 <= q <= 5*
105

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
12 votes
Tags:
Advanced Data StructuresCombinatoricsData StructuresFenwick treeMedium普通
Points:30
3 votes
Tags:
Advanced Data StructuresData StructuresFenwick (Binary Indexed) TreesMediumFenwick TreeFenwick tree
Points:30
25 votes
Tags:
Advanced Data StructuresData StructuresFenwick Tree