String query
Practice
4.7 (29 votes)
Algorithms
Approved
Implementation
Medium
Open
Trees
Problem
81% Success 3139 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Given a string s and m queries. For each query delete the K-th occurence of a character x.

Input:
The first line contains the string s followed by an integer m. The string consists of lowercase letters. After that m lines follow each line containing the integer K and the character x.

Output:
Print the string after all the m queries.

Constraints:
1<=string length <=2*10^5
1<=m<=40000

Note: It is guaranteed that the operations are correct, that is , the letter to be deleted always exists and the string is never empty.

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
3 votes
Tags:
Advanced Data StructuresData StructuresFenwick (Binary Indexed) TreesMediumFenwick TreeFenwick tree
Points:30
4 votes
Tags:
Data StructuresFenwick treeMedium
Points:30
21 votes
Tags:
DatastructuresFenwick (Binary Indexed) TreesInversion CountFenwick TreeAdvanced Data StructuresData StructuresSegment tree