#K38852. Find Target Positions

    ID: 26290 Type: Default 1000ms 256MiB

Find Target Positions

Find Target Positions

You are given a list of integers and a target integer. Your task is to find all 1-indexed positions of the target in the list.

If the target is not present in the list, output -1.

The positions can be defined mathematically as: \( \{ i \mid \text{array}[i-1] = target \} \).

For example, given the list: 4 5 6 7 5 6 4 5 8 1 and target 5, the correct output is: 2 5 8.

inputFormat

The input is given in two lines:

  • The first line contains a space-separated list of integers.
  • The second line contains a single integer denoting the target number.

outputFormat

Print the 1-indexed positions of the target in the list, separated by a single space. If the target is not found, print -1.

## sample
4 5 6 7 5 6 4 5 8 1
5
2 5 8