eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Tetris Alphabet

Tetris Alphabet

The game of Tetris is played with four-connected blocks falling down the well having \textbf{N} rows and \textbf{20} columns. Each figure is marked with a unique English letter from '\textbf{A}' to '\textbf{Z}'. Your program must, given the state of the well, determine the order in which the blocks fell down. \InputFile The first line of input file contains integer \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{50}) --- number of rows. Following \textbf{N} lines contain \textbf{20} characters each, with characters that are either a letter from '\textbf{A}' to '\textbf{Z}' or the dot character (\textbf{ASCII 46}), representing an empty cell. \OutputFile Output file must contain a string of letters indicating the order in which figures fell down. If there is more than one order, lexicographically smallest one must be printed. Input data will guarantee that at least one nonempty order exists.
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
6
...........XX.......
..........MMMM......
..........K.........
........KKK.........
.....ZAAA.FFF.......
.....ZZZA..F.B......
Выходные данные #1
BFZAKMX
Источник ACM ICPC 2002/2003 Quarterfinal (Far-Eastern Subregion) Vladivostok, November 2, 2002.