시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 282 122 100 45.455%

문제

아래와 같은 가로 세로 퍼즐을 풀어보자.

가로줄

  1. device used to cool a PC
  2. solid water
  3. to obtain

세로줄

  1. small, soft, sweet fruit
  2. strong playing card
  3. fisherman's tool

6개의 단어가 주어졌을 때, 이를 가지고 가로 세로 퍼즐을 만드는 프로그램을 작성하시오. 단어 3개는 가로줄, 3개는 세로줄로 배치해야한다.

입력

6개의 줄에 알파벳 대문자로 이루어진 단어가 주어진다. 이 단어는 사전순으로 정렬되어 있다.

출력

6개 단어를 3*3 가로 세로 퍼즐에 놓을 수 없다면 0을 출력한다. 그렇지 않다면, 3개 줄에 퍼즐을 출력한다. 만약 가능한 답이 여러개라면 사전순으로 앞서는 것을 출력한다. 사전순으로 비교를 할 때는, 모두 한 줄로 이어붙인 9개의 단어를 생각하면 된다.

예제 입력 1

ANA
ANA
DAR
DAR
RAD
RAD

예제 출력 1

DAR
ANA
RAD
W3sicHJvYmxlbV9pZCI6IjI3ODQiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjMDBcdWI4NWMgXHVjMTM4XHViODVjIFx1ZDM3Y1x1Yzk5MCIsImRlc2NyaXB0aW9uIjoiPHA+XHVjNTQ0XHViNzk4XHVjNjQwIFx1YWMxOVx1Yzc0MCBcdWFjMDBcdWI4NWMgXHVjMTM4XHViODVjIFx1ZDM3Y1x1Yzk5MFx1Yzc0NCBcdWQ0ODBcdWM1YjRcdWJjZjRcdWM3OTAuPFwvcD5cclxuXHJcbjxwPjxpbWcgYWx0PVwiXCIgc3JjPVwiXC91cGxvYWRcL2ltYWdlc1wvU2NyZWVuJTIwU2hvdCUyMDIwMTMtMDEtMjglMjBhdCUyMCVFQyU5OCVBNCVFRCU5QiU4NCUyMDVfNDFfMzYucG5nXCIgc3R5bGU9XCJoZWlnaHQ6MTUwcHg7IHdpZHRoOjE3OHB4XCIgXC8+PFwvcD5cclxuXHJcbjxwPl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