시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 152 79 77 58.333%

문제

영현이는 서커스 회사에 다닌다. 방금 영현이는 길이 기준으로 오름차순으로 정렬된 이름 목록을 출력하는 프로그램을 작성했다(이름은 적어도 한자 이상이다). 

하지만, 팀장은 그런 방식의 출력을 원하지 않고, 대신 맨 위와 아래는 짧고 가운데는 긴 대칭적인 출력을 원한다. 그 규칙은 이름 한 쌍이 서로 반대 목록에 속해야 하고 더 긴 이름이 중간에 오는 식이다. 한 쌍의 첫번째로 오는 이름이 위쪽 목록에 있어야 한다. 

첫번째 예시가 밑에 있는데, Bo와 Pat은 첫째 쌍, Jean과 Kevin은 두번째 쌍, 기타..등등

입력

입력은 한 개 이상의 문자열을 포함한다, 0의 입력으로 프로그램을 종료한다. 

각 세트는 들어갈 문자열의 개수인 정수 n으로 시작한다. 입력은 한 줄에 한개씩, 길이 기준으로 오름차순으로 정렬된 문자열 n개가 입력된다. 문자열에 공백은 포함하지 않는다. 문자열은 최소 1개, 최대 15개까지 입력을 받을 수 있다. 각 문자열의 길이는 최대 25이다.

출력

각 세트에 대해 "SET n"을 첫째 줄에 출력해라. 여기서 n은 1부터 시작한다. 

예제 입력 1

7
Bo
Pat
Jean
Kevin
Claude
William
Marybeth
6
Jim
Ben
Zoe
Joey
Frederick
Annabelle
5
John
Bill
Fran
Stan
Cece
0

예제 출력 1

SET 1
Bo
Jean
Claude
Marybeth
William
Kevin
Pat
SET 2
Jim
Zoe
Frederick
Annabelle
Joey
Ben
SET 3
John
Fran
Cece
Stan
Bill
W3sicHJvYmxlbV9pZCI6IjQ2MzEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWIzMDBcdWNlNmQgXHVjODE1XHViODJjIiwiZGVzY3JpcHRpb24iOiI8cD5cdWM2MDFcdWQ2MDRcdWM3NzRcdWIyOTQgXHVjMTFjXHVjZWU0XHVjMmE0IFx1ZDY4Y1x1YzBhY1x1YzVkMCBcdWIyZTRc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-Central Regional Programming Contest C번

  • 잘못된 번역을 찾은 사람: jh05013
  • 문제를 번역한 사람: ryh2803