Love Calculator

5

1 votes
Merge sort, Advanced sorting
Problem

We know that there is a doubt that to who loves Bheem the most, Chutki or Indumati.
To check this, Bheem started making a software : Love Calcultor which has diiferent versions.

Software versions are represented by a series of numbers, divided up into major, minor and revision integers. New versions of an software increase the major number, e.g. 1, 2, 3, and so on. When new features are added to an software without being a complete new version, a second number named "minor" can be used to represent those new additions, e.g.  1.2, 1.4 etc. Small fixes or maintenance can be represented by a third number named "revision", e.g. 1.1.0, 1.1.2, 1.3.0, and so on. The number zero can be used as a major for pre-release versions of elevators, e.g. 0.1, 0.2, 0.7.2, etc.

Given a list of software versions represented as strings. The versions in list will always contain major numbers, but minor and revision numbers are optional. If the version contains a revision number, then it will also have a minor number.

Since, Bheem lives in Dholakpur and all the verison were made by "Avi Chacha". He doesn't want to lose the order of the version and ask you to help him. 

Note1 : If two or more versions are equivalent but one version contains more numbers than the others, then these versions must be sorted ascending based on how many numbers they have, e.g ["1", "1.0", "1.0.0"].

Range of versions [ 0.0.0 to 99.99.99]

Note2: There is no verison having a number which is multiple of 10 except 0.

Example: 10.20.19 10.40.30 1.10.10 are invalid but 1.0.19 1.4.33 1.1.11 0.0.1 0.0.0 0.12.0 are valid.

Constratins

1 ≤ N ≤ 100

Input

The first line contains ‘n’, size of the list

Then next line contains ‘n’ space separated software versions.

Output

Print single line containing list of software versions in sorted order(or according to the release version) separated by commas and then a space (refer sample output).

 

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

The given versions are printed in sorted ordered

Editor Image

?