Row 3
A vertically positioned rectangular paper strip, fixed at the lower end, is folded as follows:
In the first step, the strip is folded in half so that the upper half lies on the lower half, either in front (P-fold) or behind (Z-fold).
In the subsequent n-1 steps, similar folds are made with the strip obtained from the previous step, treating it as a single unit.
After all the folds, the strip is unfolded back to its original state. It retains creases from the folds, with some creases facing towards us (K-edges) and others facing away (O-edges). The creases are numbered sequentially from top to bottom, from 1 to 2^n-1.
The task is to write a program that, given a string of uppercase letters "O" and "K", where the i-th position indicates the type of edge on the unfolded strip, determines a sequence of uppercase "P" and "Z" that represents the fold sequence used to achieve this pattern of edges.
Input
The first line of the input file contains the number n, representing the number of folds (n is no more than 20). The second line contains a string of 2^n-1 characters, each being "O" or "K", indicating the types of edges on the unfolded strip.
Output
Output a single line containing a string of n characters, each being "P" or "Z", that specifies the sequence of folds. If no such sequence exists, output NO.