#1005
Unrated
IGRA
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Goran Gašić

Having solved the tedious assignment, Mirko decided to play a game with his good friend Slavko. They have written a sequence of N letters on a piece of paper. Each one of them is trying to put together a word using letters from the sequence. They alternate taking turns consisting of removing a single letter from the sequence and appending it to the end of their word. Mirko has the first turn. The game ends when no letters are remaining in the sequence. We define a word to be more beautiful than another word if it comes first alphabetically. The player who has the more beautiful word at the end of the game wins. If both players have equal words, they both lose. Mirko is a much better player than Slavko, so he has decided to make it easier for Slavko by always selecting the rightmost remaining letter in the sequence. Knowing this, Slavko wants to find out if it is possible for him to win and which is the most beautiful word he can end the game with.

입력

The first line of input contains an even positive integer N (2 ≤ N ≤ 100 000). The second line of input contains N characters, the starting letter sequence. All characters are lower case letters from the English alphabet.

출력

The first line of output must contain “DA” if it is possible for Slavko to win, and “NE” otherwise. The second line of output must contain the most beautiful word that Slavko can have at the end of the game.

예제 입력 1

2
ne

예제 출력 1

NE
n

예제 입력 2

4
kava

예제 출력 2

DA
ak

예제 입력 3

8
cokolada

예제 출력 3

DA
acko
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.