✕
CollectionsCoding problems
Collections: coding problems
Write a program that reads the input and prints the answer. Run checks it against every test, including hidden ones.
0 of 7 solved
A cashier scans product codes one after another. The store wants to know the first code that shows up for the second time, so it can check for a double scan.
Read the codes from left to right. Print the first code whose second copy you meet. If no code repeats, print
none.**Constraints:** 1 <= n <= 100000. Each code is an integer from -1,000,000,000 to 1,000,000,000.
Input. First line n. Second line n integers, separated by spaces.
Output. One line: the first repeated code, or `none`.
Example 1 input
5 3 1 4 1 5
Output
1
Example 2 input
4 1 2 3 4
Output
none