Football Match

시간 제한1초메모리 제한512 MB

요약
각 선수가 심판일 때 공정한 팀 나누기가 가능한지를 나타내는 Y/N 문자열이 주어지면, 그 조건을 모두 만족하도록 1 이상 10000 이하의 실력값을 선수마다 정한다.
난이도

보통10점 중 7점

유형
그리디, 수학, 조합론, 구현
정답자
아직 제출이 없습니다

문제

Zenyk wants to play football, and n − 1 friends join him. All players have skill level — an integer between 1 and 10 000.

Players want to choose a referee and then divide into two teams such that each player is either the referee or a member of one of the teams, and the sums of skills of players in both teams are the same. So that will be a fair game.

Unfortunately all of them forgot their own skill levels. But each player remembers if it’s possible to divide into teams when he is a referee.

Find such skill values that satisfy all conditions. If several possible answers exist print any of them.

입력

The first line contains one integer n (3 ≤ n ≤ 50).

The second line contains a string of length n. The i-th character of this string equals “Y” if it’s possible to divide players into teams if i-th player is a referee, and “N” otherwise.

출력

In the first line, print “YES” if at least one possible set of values exists, and “NO” otherwise. If the answer is “YES”, print n integers — the corresponding values. These values should be between 1 and 10 000. If several possible answers exist, print any of them.

예제1

  1. 예제 1

    입력
    4
    YNNY
    
    예상 출력
    YES
    3 1 2 3