#C12947. First Duplicate Number

    ID: 42430 Type: Default 1000ms 256MiB

First Duplicate Number

First Duplicate Number

You are given a list of integers. Your task is to find the first duplicate number in the list. The first duplicate is defined as the integer for which the index of its second occurrence is the smallest among all duplicates.

If there is no duplicate in the input, output None. Formally, given an array \( nums \), find the element \( x \) such that the second occurrence of \( x \) appears before the second occurrence of any other number and output \( x \). If no such \( x \) exists, output "None".

Note: All input and output are taken from standard input (stdin) and standard output (stdout) respectively.

inputFormat

The input consists of a single line containing space-separated integers. These integers represent the elements of the list \( nums \).

For example:

1 2 3 4 2 3 1

outputFormat

Output a single line. If a duplicate exists, print the first duplicated integer. Otherwise, print None (without quotes).

## sample
1 2 3 4 5
None