#C2160. Capitalize Specified Positions

    ID: 45446 Type: Default 1000ms 256MiB

Capitalize Specified Positions

Capitalize Specified Positions

You are given a string s and a list of integer indexes. Your task is to capitalize the characters of the string at the specified indexes. If an index is out of the range of the string, it should be ignored.

The problem involves string manipulation and proper indexing. Pay attention to the 0-indexing convention and ensure that the output exactly matches the expected transformation.

Note: The indexes provided in the input might be unsorted and may contain duplicate values or invalid positions (negative or out-of-bound). Process only the valid indexes.

The transformation is defined formally as follows: \[ \text{result}[i]= \begin{cases} \text{UpperCase}(s[i]) & \text{if } i \in I \text{ and } 0 \le i < |s|, \ s[i] & \text{otherwise,} \end{cases} \] where I is the set of provided indexes and \( |s| \) denotes the length of the string.

inputFormat

The input is given via stdin and consists of two lines:

  • The first line contains the string s which may include spaces.
  • The second line contains a space-separated list of integers that represent the indexes to be capitalized. This line may be empty if no indexes are provided.

outputFormat

Output the modified string after capitalizing the characters at the specified indexes. The output should be printed to stdout.

## sample
hello world
1 3
hElLo world