Word on the Paper纸上单词

发布于:2024-12-07 ⋅ 阅读:(19) ⋅ 点赞:(0)

time limit per test

1 second

memory limit per test

256 megabytes

On an 8×88×8 grid of dots, a word consisting of lowercase Latin letters is written vertically in one column, from top to bottom. What is it?

Input

The input consists of multiple test cases. The first line of the input contains a single integer tt (1≤t≤10001≤t≤1000) — the number of test cases.

Each test case consists of 88 lines, each containing 88 characters. Each character in the grid is either .. (representing a dot) or a lowercase Latin letter (aa–zz).

The word lies entirely in a single column and is continuous from the beginning to the ending (without gaps). See the sample input for better understanding.

Output

For each test case, output a single line containing the word made up of lowercase Latin letters (aa–zz) that is written vertically in one column from top to bottom.

Example

Input

Copy


5

........

........

........

........

...i....

........

........

........

........

.l......

.o......

.s......

.t......

........

........

........

........

........

........

........

......t.

......h.

......e.

........

........

........

........

........

.......g

.......a

.......m

.......e

a.......

a.......

a.......

a.......

a.......

a.......

a.......

a.......

Output

Copy

i
lost
the
game
aaaaaaaa

4

每项测试的时间限制

1 秒

每项测试的内存限制

256 兆字节

在一个 8×88×8 的点网格上,一个由小写拉丁字母组成的单词从上到下垂直写在一列中。这是什么?

输入

输入由多个测试用例组成。输入的第一行包含一个整数 tt(1≤t≤10001≤t≤1000)——测试用例的数量。

每个测试用例由 88 行组成,每行包含 88 个字符。网格中的每个字符要么是 ..(代表一个点),要么是小写拉丁字母(aa–zz)。

单词完全位于一列中,从头到尾连续(没有间隙)。请参阅示例输入以更好地理解。

输出

对于每个测试用例,输出一行由小写拉丁字母(aa–zz)组成的单词,该单词从上到下垂直写在一列中。

示例

输入

复制

5

........

........

........

........

...i....

........

........

........

........

.l......

.o......

.s......

.t......

........

........

........

........

........

........

........

........

......t.

......h.

......e.

........

........

........

........

........

.......g

.......a

.......m

.......e

a.......

a.......

a.......

a.......

a.......

a.......

a.......

a.......

a.......

输出

复制


输了

游戏
aaaaaaaa

4

代码:

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int t;
    cin >> t;

    while (t--) {
        vector<string> grid(8);
        for (int i = 0; i < 8; i++) {
            cin >> grid[i];
        }

        for (int col = 0; col < 8; col++) {
            string word = "";
            for (int row = 0; row < 8; row++) {
                if (grid[row][col] != '.') {
                    word += grid[row][col];
                }
            }
            if (!word.empty()) {
                cout << word << endl;
                break;
            }
        }
    }

    return 0;
}


网站公告

今日签到

点亮在社区的每一天
去签到