P27357 [AtCoder] Reading Zero
提高
题目描述

Problem Description

You are given $ N $ strings $ S_i $. Each $ S_i $ is a string consisting only of digits.

Treat these strings as decimal numbers and output them in ascending order. If two numbers are equal, the one with more leading zeros should come first.

Input Format

The input is given from the standard input in the following format:

$ N $ $ S_1 $ $\vdots$ $ S_N $

Output Format

Sort the given strings in the specified order and output them separated by newlines.

Sample Input and Output

Sample Input #1

5
2
1
01
1
0010

Sample Output #1

01
1
1
2
0010

Sample Input #2

6
1111111111111111111111
00011111111111111111111
000000111111111111111111
0000000001111111111111111
00000000000011111111111111
000000000000000111111111111

Sample Output #2

000000000000000111111111111
00000000000011111111111111
0000000001111111111111111
000000111111111111111111
00011111111111111111111
1111111111111111111111

Notes/Hints

Note

Discussion of this problem is prohibited until 2020/12/27 18:00 JST. If mentioned, legal action may be taken. It is okay to publish the total score or certification level after the exam, but please do not disseminate information about which problems were solved.

Constraints

  • $1\leq\ N\ \leq\ 10^5$
  • The total length of $ S_i $ is at most $ 10^5 $
  • $ S_i $ consists only of digits

Sample Explanation 1

$ S_2, S_3, S_4 $ all have the value $ 1 $, but they should be output in order from the one with the most leading zeros.

Sample Explanation 2

The given strings may be very long.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 2 1 01 1 0010
样例输出
01 1 1 2 0010