All problems

Second Largest Number

easyPythonArraysSorting

A council opens a set of sealed tenders and lists the offers on one line. The highest offer wins, but the runner-up matters too: it is the fallback if the winner withdraws. Offers can be negative, because a contractor may bid a subsidy. Nothing stops two contractors naming the same amount, and when that happens at the top of the list the council does not treat the two of them as winner and fallback — they are joint winners, and the fallback is the next amount down.

Task: Read the offers and print the runner-up: the highest amount that is lower than the winning amount.

Input

A single line holding between 2 and 100 integers, separated by single spaces. Any of them may be negative or zero, and the same amount may be offered more than once. At least two of the amounts differ, so a runner-up always exists.

Output

One line holding a single integer: the runner-up amount.

Example:

Input:
10 5 8 20 3

Output:
10

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…