QOJ.ac

QOJ

时间限制: 1 s 内存限制: 1024 MB 总分: 100

#16818. 蛇形字符串

统计

蛇形字符串(snakey string)是一种对普通文本字符串的别致呈现方式。当一个字符串被转化为蛇形时,它会被放置在一个二维网格中,并满足以下条件:

  • 字符串的第一个字符位于网格的第一列,第二个字符位于第二列,……,最后一个字符位于最后一列。
  • 字符串中的每个字符都位于其前一个字符所在行的正上方一行或正下方一行。

图 A.1:样例中的蛇形字符串

给定一个蛇形字符串,你能恢复出原始字符串吗?

输入格式

输入的第一行包含两个整数 $r$ 和 $c$($2 \le r, c \le 100$),分别表示网格的行数和列数。

接下来的 $r$ 行,每行包含 $c$ 个字符,构成包含蛇形字符串的二维网格。空白单元格用英文句点(.)表示,而大写字母(A-Z)表示原始字符串中的字符。网格中的每一列都恰好包含一个大写字母。某些行可能不包含任何大写字母。

输出格式

输出一个字符串,即用于构建该蛇形字符串的原始字符串。

样例

输入样例 1

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

输出样例 1

BIGSOUTH

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.