ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1546. Japanese Sorting

Time limit: 1.0 second
Memory limit: 64 MB
The Japanese like to take photos. But photos taken with a digital camera are not always sorted correctly on a computer. For example, a file photo12.jpg is for some reason put between files photo1.jpg and photo2.jpg, and hence the photos are viewed in the wrong order. Some Japanese use a system that sorts lines according to different, Japanese, rules, and in this case numbers are sorted in the natural way.
Lexicographic orderJapanese order
photo2
photox1
photox10
photox2
photo2
photox1
photox2
photox10
We will not give the Japanese rules in details here. They are rather simple and logical. In order to determine these rules, just fill yourself with the spirit of Japan.

Input

The input consists of several lines, which contain lowercase Latin letters and digits only. The total amount of the input does not exceed 100 KB.

Output

Output the same lines sorted according to the Japanese rules.
In order to eliminate all ambiguities with respect to the Japanese rules, you may use a reference program, which sorts according to these rules but has some limitations: it sorts no more than 15 lines each of which is no longer than 30 symbols. The program is available here.

Sample

inputoutput
photox10
photox1
photo2
photox2
photo2
photox1
photox2
photox10
Problem Author: Vladimir Yakovlev
Problem Source: The 11th Urals Collegiate Programing Championship, Ekaterinburg, April 21, 2007