Sort Mixed Tokens

Programming Interview Hard 4 views
Back to Questions

Problem Description

You get {x}. Token types: INT, FLOAT (with dot), WORD. Sort by type order INT then FLOAT then WORD. For ints sort by numeric value, for floats sort by numeric value, for words sort lexicographically. Output sorted tokens in one line.

Input Format

First line n. Second line n tokens.

Output Format

One line sorted tokens.

Sample Test Case

Input:
7 10 2.5 apple -1 3.0 bat 2
Output:
-1 2 10 2.5 3.0 apple bat

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next