每日一题 第四十七期 Codeforces Round 886 (Div. 4)

C. Word on the Paper

time limit per test: 1 second

memory limit per test: 256 megabytes

input: standard input

output: standard output

On an 8 × 8 8 \times 8 8×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 t t t ( 1 ≤ t ≤ 1000 1 \leq t \leq 1000 1t1000) — the number of test cases.

Each test case consists of 8 8 8 lines, each containing 8 8 8 characters. Each character in the grid is either . \texttt{.} . (representing a dot) or a lowercase Latin letter ( a \texttt{a} a z \texttt{z} z).

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 ( a \texttt{a} a z \texttt{z} z) that is written vertically in one column from top to bottom.

Example
inputCopy
5




…i…




.l…
.o…
.s…
.t…







…t.
…h.
…e.





…g
…a
…m
…e
a…
a…
a…
a…
a…
a…
a…
a…
outputCopy
i
lost
the
game
aaaaaaaa

AC代码:

#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<queue>
#include<string>
#include<bitset>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<numeric>
//#define endl '\n'
using namespace std;

typedef long long ll;
typedef pair<int, int>PII;
const int N=3e5+10;
const int MOD=998244353;
const int INF=0X3F3F3F3F;
const int dx[]={-1,1,0,0,-1,-1,+1,+1};
const int dy[]={0,0,-1,1,-1,+1,-1,+1};
const int M = 1e8 + 10;

int t;
char c[10][10];
int main()
{
	cin >> t;
	while(t --){
		string a;
		for(int i = 1; i <= 8; i ++)
		{
			for(int j = 1; j <= 8; j ++)
			{
				cin >> c[i][j];
				if(isalpha(c[i][j])) a += c[i][j];
			}
		}
		cout << a << endl;
	}
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值