QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 1024 MB 満点: 100

#17527. Sightseeing Course

統計

In the UCPC Kingdom, there is a circular sightseeing course consisting of $N$ segments that allows one to tour the entire kingdom. In each segment, there is a shuttle bus that can take you to the next segment. For $1 \leq i < N$, you can move from the $i$-th segment to the $(i+1)$-th segment, and from the $N$-th segment, you can move to the $1$-st segment.

Now, $N$ tourists from the North Pole are planning to tour the UCPC Kingdom using this sightseeing course. The $i$-th tourist starts at the $i$-th segment and tours a total of $N$ segments by taking the shuttle buses.

Each segment is either a snowy field or a desert. Each tourist starts at their starting point with a favorability score of $1$. Every time they pass through a snowy field segment, their favorability score increases by $1$, and every time they pass through a desert segment, their favorability score decreases by $1$. If a tourist's favorability score becomes $0$ at any point during the tour, they immediately stop the tour and leave for their home country. If, after visiting all $N$ segments of the course, their favorability score is $1$ or greater, the tourist purchases an expensive souvenir from the UCPC Kingdom and returns to their home country.

As someone living in the North Pole, you know whether each tourist purchased a souvenir, and you must use this information to determine the structure of the UCPC Kingdom's sightseeing course. Given the souvenir purchase status of tourists from $1$ to $N$, output one possible structure of the sightseeing course.

Input

The first line contains $N$, the number of segments in the sightseeing course. $(1 \leq N \leq 500\,000)$

The second line contains a string of length $N$ representing whether the $i$-th tourist purchased a souvenir. The $i$-th character represents the status of the $i$-th tourist: O if they purchased a souvenir, and X if they did not.

Output

If a possible sightseeing course exists for the given input, output YES on the first line and a string of length $N$ on the second line. The $i$-th character should be + if the $i$-th segment is a snowy field, and - if it is a desert.

If no such sightseeing course exists for the given input, output NO on the first line.

Examples

Input 1

5
OXOXO

Output 1

YES
+-+-+

Input 2

6
XXXXXX

Output 2

YES
+--+--

Input 3

5
XXXOX

Output 3

NO

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.