Hide

Problem A
Charting Progress

You’re consulting for a fitness training institute which is working on becoming more technologically adept. Currently, it has an old computer which tracks various statistics about athletes in training. Each day, the athlete logs in and records a single number, which is information about their workout. For example, a runner may record the number of miles run. The computer simply stores this until the trainer requests a log for an athlete. The computer then prints a log in text format indicating each record.

The original log is in column-major format, where each column represents one record (such as miles run that day). Since the records may fluctuate, the trainer wants a log that is easier to analyze. Your job is to write a program which orders the records (columns) from least to greatest value (asterisks progressing from the lowest to the highest rows), so that the trainer can get a different, smoother view of an athlete’s progress.

Input

Input is a series of at most $100$ logs that should be processed. Each log is a rectangular block of text of size at most $80$ columns and $100$ rows (one row is one line). Most of the characters are periods (.), but each column has exactly one asterisk (*) indicating the value recorded for the day. Each column in a log has the same height.

Between each pair of logs is a blank line. Input ends at the end of the file.

Output

For each log, print out the log in the desired (sorted) order. Print a blank line between each pair of logs printed.

Sample Input 1 Sample Output 1
...........*........
....*.....*.........
.........*..*...*...
*..*..*......***....
..*.....*...........
.*..................
.......*.........*.*
....................
.....*............*.

..........
.*.**.*...
*....*.*.*
..........
..*.....*.
...................*
.................**.
..............***...
........******......
......**............
.....*..............
..***...............
....................
**..................

..........
......****
..****....
..........
**........

Please log in to submit a solution to this problem

Log in