프로그램 명: coci_krizaljka
제한시간: 1 초

[요약] 3*3짜리 크기의 크로스워드(십자말)가 있습니다. 그림과 같은 6개의 문제가 있는 3*3짜리 크로스워드는 입문자를 위한 간단한 문제인데요,

6개의 문제에 대해 6개의 정답이 주어졌을 때 완성된 크로스워드의 형태를 출력하는 문제입니다. 완성할 수 있는 방법이 하나 이상이라면 세 개의 행을 일렬로 놓았다고 가정할 때 알파벳 순으로 가장 빠른 것을 출력하세요.

크로스워드를 완성할 수 없다면 0을 출력하세요.

예제 1번 보충:

DAR 
ANA 
RAD 

가로 1: DAR 
가로 2: ANA 
가로 3: RAD 
세로 1: DAR 
세로 2: ANA 
세로 3: RAD 

Do you like to solve crosswords? If you do, you probably know the traditional lead-in for beginners . small 3 by 3 crosswords, like the following

Solve a crossword like this one! Not gonna happen? Fine, then at least put it together given six words that appear in it (three as horizontal and three as vertical).

입력

Each of the six lines of input contains a word consisting of three uppercase English letters. The words are given in a lexicographically sorted order.

출력

If it is impossible to put together a 3 by 3 crossword using the given six words, output 0. Otherwise, output the crossword in three lines.

If there is more than one possible solution, output the one that is first in lexicographic order, where, for sorting purposes, the crossword is viewed as a nine-letter word obtained by concatenating its rows.

입출력 예

input

ANA
ANA
DAR
DAR
RAD
RAD

output

DAR
ANA
RAD

input

EVO
HEP
HIR
IVA
PAD
ROD

output

HEP
IVA
ROD

input

AKO
CES
DOC
DON
ESI
KES

output

0
출처:coci/2012-2013/contest2(adapted from http://www.goobix.com/crosswords/0303/) 2/6
요약: ladown21

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]