All submissions for this problem are available.
Given a string s and m queries. For each query delete the n-th occurence of a character x..
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 n and the character x.
- 1 ≤ string length ≤ 2*10^5
- 1 ≤ m ≤ 40000
Print the string after all the m queries.
It is guaranteed that the operations are correct, that is , the letter to be deleted always exists and the string is never empty.
Input: abcdbcaab 5 2 a 1 c 1 d 3 b 2 a Output: abbc
After query 1: abcdbcab
After query 2: abdbcab
After query 3: abbcab
After query 4: abbca
After query 5: abbc
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.