#C1443. Taco Query Processing

    ID: 44078 Type: Default 1000ms 256MiB

Taco Query Processing

Taco Query Processing

You are given a string s and a series of queries. There are two types of queries:

  • Type 1: 1 i c which means replace the character at position \(i\) (1-indexed) with character \(c\).
  • Type 2: 2 L R which asks you to find and output the lexicographically smallest character in the substring \(s[L\ldots R]\) (both \(L\) and \(R\) are 1-indexed).

Process the queries in the given order and for each Type 2 query output the result on a new line.

Note: All positions provided are 1-indexed. The lexicographical order is defined as the natural order of characters.

inputFormat

The input is given via standard input (stdin) and has the following format:

  1. The first line contains the initial string s.
  2. The second line contains an integer Q, the number of queries.
  3. The following Q lines each contain a query in one of the following formats:
    • For a Type 1 query: 1 i c.
    • For a Type 2 query: 2 L R.

outputFormat

For each query of Type 2, output the lexicographically smallest character in the specified substring on a separate line to standard output (stdout).

## sample
abracadabra
5
2 1 3
1 3 c
2 1 3
2 7 11
1 5 z
a

a a

</p>