[요약] 3*3짜리 크기의 크로스워드(십자말)가 있습니다. 그림과 같은 6개의 문제가 있는 3*3짜리 크로스워드는 입문자를 위한 간단한 문제인데요,
6개의 문제에 대해 6개의 정답이 주어졌을 때 완성된 크로스워드의 형태를 출력하는 문제입니다. 완성할 수 있는 방법이 하나 이상이라면 세 개의 행을 일렬로 놓았다고 가정할 때 알파벳 순으로 가장 빠른 것을 출력하세요.
크로스워드를 완성할 수 없다면 0을 출력하세요.
예제 1번 보충:
DAR ANA RAD 가로 1: DAR 가로 2: ANA 가로 3: RAD 세로 1: DAR 세로 2: ANA 세로 3: RAD
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).
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