1283: 01串排序

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:3 Solved:3

Description

将01串首先按长度排序,长度相同时,按1的个数多少进行排序1的个数相同时再按ASCII码值排序(字典序)。

Input

第一行输入一个整数n(1≤n≤100),表示字符串的个数。输入数据中含有一些01串,01串的长度不大于256个字符

Output

第一行输入一个整数n(1≤n≤100),表示字符串的个数。输入数据中含有一些01串,01串的长度不大于256个字符

Sample Input Copy

6
10011111
00001101
1010101
1
0
1100

Sample Output Copy

0
1
1100
1010101
00001101
10011111