String Conversion and Queries
InterviewTime limit3sMemory limit512 MB
Apply character replacement queries to a string in order and print the current string for each print query.
- Level
Medium5 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
You are given a string of uppercase and lowercase English letters. You are also given a list of queries on . Each query is one of the following two types.
- : Change every character in to the character . If has no character , is not changed.
- : Print after applying all type queries given so far, in order.
Input
The first line contains the string and the integer in that order.
Each of the next lines contains one query, from the first query to the last. A type query is the integer followed by the characters and , separated by a space. A type query is the integer alone.
Output
For each type query, print the result on its own line, in order.
Constraints
- length of
- consists of uppercase and lowercase English letters.
- Every query in is of type or type .
- contains at least one type query.
- total number of characters printed by type queries
- Newline characters are not counted as printed characters.
- and are uppercase or lowercase English letters.