시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB12111610995.614%

문제

A snakey string is a fancy rendering of an otherwise normal string of text. When a string is made snakey, it is placed on a 2D grid such that the following conditions are met:

  • The first character of the string is on the first column of the grid, the second on the second column, …, and the last on the last column.
  • Each character in the string occupies either the row directly above or directly below the row of the previous character.

Figure 1: The snakey string in the sample case.

Given a snakey string, can you recover the original string?

입력

The first line of input contains two integers $r$ and $c$ ($2 \le r, c \le 100$), the number of rows and columns of the grid.

The next $r$ lines each contain $c$ characters that form the 2D grid containing the snakey string. Empty cells are encoded with a period, while uppercase letters (A-Z) represent characters in the original string. Every column in the grid contains exactly one uppercase letter. It is possible that some rows do not contain any uppercase letters.

출력

Output a single string, the original string that was used to build this snakey string.

예제 입력 1

4 8
..G.....
.I.S.U..
B...O.T.
.......H

예제 출력 1

BIGSOUTH