#K93602. Modify Array Elements at Specific Indices
Modify Array Elements at Specific Indices
Modify Array Elements at Specific Indices
You are given a one-dimensional array ( A = [a_0, a_1, \dots, a_{n-1}] ) and a list of indices. Your task is to modify the array such that for every index ( i ) provided in the indices list, the corresponding element ( a_i ) is set to 99.
For example, if ( A = [10, 20, 30, 40, 50] ) and the indices list is [1, 3], then the modified array becomes ( [10, 99, 30, 99, 50] ).
Read the input from stdin: the first line contains the elements of the array separated by spaces, and the second line contains the indices separated by spaces (this line may be empty, meaning no modifications). Output the modified array to stdout with elements separated by a single space.
inputFormat
The input consists of two lines:
1. The first line contains a list of integers (( A )) separated by spaces.
2. The second line contains a list of indices separated by spaces. If no indices are provided, the second line will be empty.
outputFormat
Print the modified array with each element separated by a space.## sample
10 20 30 40 50
1 3
10 99 30 99 50