#K4506. First Unique Integer

    ID: 27669 Type: Default 1000ms 256MiB

First Unique Integer

First Unique Integer

You are given a list of integers. Your task is to identify the first integer that appears exactly once in the list. Formally, given a sequence of integers (a_1, a_2, \ldots, a_n), find the first (a_i) such that it occurs only once in the sequence. If no such integer exists, output -1.

For example, if the input is [4, 5, 6, 7, 5, 6, 4], then the answer is 7 because 7 is the first number that does not repeat.

inputFormat

Input is read from standard input (stdin) as a single line of space-separated integers. The line may be empty (indicating an empty list). Integers can be positive, negative, or zero.

outputFormat

Output to standard output (stdout) the first unique integer from the list. If there is no unique integer, output -1.## sample

4 5 6 7 5 6 4
7