#K79292. Largest Number

    ID: 35276 Type: Default 1000ms 256MiB

Largest Number

Largest Number

Given a list of non-negative integers, arrange them such that they form the largest possible number. In other words, you are to create a single number by concatenating the numbers after reordering them, so that the resulting number is as large as possible.

For example, given the numbers (10) and (2), the largest number is (210). Likewise, for (3, 30, 34, 5, 9), the answer is (9534330).

inputFormat

The first line of input contains an integer (n) representing the number of elements in the list. The second line contains (n) non-negative integers separated by spaces.

outputFormat

Output a single string representing the largest number that can be formed by concatenating the given integers.## sample

2
10 2
210