시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB60814811423.554%

문제

준규, 해빈, 진욱이는 다음과 같은 게임을 한다.

먼저, 준규가 문자열 S를 고른다. 그 다음, 해빈이는 S의 뒤에 S를 붙인 새로운 문자열 T를 만든다. 마지막으로 진욱이는 문자열 T의 어딘가(시작이나 끝도 가능)에 문자 하나를 삽입해 문자열 U를 만든다.

U가 주어졌을 때, S를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 U의 길이 N이 주어지고, 둘째 줄에 U가 주어진다. U는 알파벳 대문자로만 이루어져 있다.

출력

  1. U를 만들 수 없는 경우에는 "NOT POSSIBLE"을 출력한다.
  2. U를 만들 수 있는 문자열 S가 유일하지 않다면, "NOT UNIQUE"를 출력한다.
  3. 나머지 경우에는 S를 출력한다.

서브태스크

번호 배점 제한
1 35

2 ≤ N ≤ 2001.

2 65

2 ≤ N ≤ 2000001.

예제 입력 1

7
ABXCABC

예제 출력 1

ABC

예제 입력 2

6
ABCDEF

예제 출력 2

NOT POSSIBLE

예제 입력 3

9
ABABABABA

예제 출력 3

NOT UNIQUE
W3sicHJvYmxlbV9pZCI6IjEwMDk2IiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVjMTM4IFx1Y2U1Y1x1YWQ2YyIsImRlc2NyaXB0aW9uIjoiPHA+PGltZyBhbHQ9XCJcIiBzcmM9XCJodHRwczpcL1wvdXBsb2FkLmFjbWljcGMubmV0XC83YzE2YjlhNC1hMDY0LTQ5OTgtYjc3Zi1iMDg4OTI5NjNiZGZcLy1cL3ByZXZpZXdcL1wiIHN0eWxlPVwid2lkdGg6IDE2MnB4OyBoZWlnaHQ6IDEwMHB4OyBmbG9hdDogcmlnaHQ7XCIgXC8+XHVjOTAwXHVhZGRjLCBcdWQ1NzRcdWJlNDgsIFx1YzljNFx1YzZiMVx1Yzc3NFx1YjI5NCBcdWIyZTRcdWM3NGNcdWFjZmMgXHVhYzE5XHVjNzQwIFx1YWM4Y1x1Y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HN0cmluZyBVLiBUaGUgc3RyaW5nIFUgaXRzZWxmIGlzIGdpdmVuIG9uIHRoZSBzZWNvbmQgbGluZS4gSXQgY29uc2lzdHMgb2YgTiB1cHBlcmNhc2UgRW5nbGlzaCBsZXR0ZXJzIChBLCBCLCBDLCAuLi4gLCBaKS48XC9wPlxyXG4iLCJvdXRwdXQiOiI8cD5Zb3VyIHByb2dyYW0gc2hvdWxkIHByaW50IHRoZSBvcmlnaW5hbCBzdHJpbmcgUy4gSG93ZXZlciwgdGhlcmUgYXJlIHR3byBleGNlcHRpb25zOjxcL3A+XHJcblxyXG48b2w+XHJcblx0PGxpPklmIHRoZSBmaW5hbCBzdHJpbmcgVSBjb3VsZCBub3QgaGF2ZSBiZWVuIGNyZWF0ZWQgdXNpbmcgdGhlIGFib3ZlIHByb2NlZHVyZSwgeW91IHNob3VsZCBwcmludCBOT1QgUE9TU0lCTEUuPFwvbGk+XHJcblx0PGxpPklmIHRoZSBvcmlnaW5hbCBzdHJpbmcgUyBpcyBub3QgdW5pcXVlLCB5b3Ugc2hvdWxkIHByaW50IE5PVCBVTklRVUUuPFwvbGk+XHJcbjxcL29sPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwiaHRtbF90aXRsZSI6IjAiLCJwcm9ibGVtX2xhbmdfdGNvZGUiOiJFbmdsaXNoIiwic3VidGFzazEiOiI8cD4yICZsZTsgTiAmbGU7IDIwMDEuPFwvcD5cclxuIiwic3VidGFzazIiOiI8cD4yICZsZTsgTiAmbGU7IDIwMDAwMDEuPFwvcD5cclxuIn1d

출처

Olympiad > Baltic Olympiad in Informatics > BOI 2014 2번

채점 및 기타 정보

  • 예제는 채점하지 않는다.