First Duplicate

Lab Python Intermediate 20 points

Read a line of words and print the first word that appears for the second time. If none repeats, print none.

Input

One line.

Output

A word or none.

Example

Input

a b c b a

Output

b
Sample input available Sample output available
Editor
Python

Hints

Keep a set of words already seen.

Checking x in a set is very fast.

Solution explanation

Membership tests on a set take constant time, unlike lists which must be scanned.

Show solution
seen = set()
for w in input().split():
    if w in seen:
        print(w)
        break
    seen.add(w)
else:
    print("none")
Output
Answer
HOME LEARN COMMUNITY DASHBOARD