Marching Orders Dean Bob Roberts is in charge of the order in which the professors of his college march in the graduation ceremonies. Due to complaints among certain professors from the newly created DEI Studies Department it has been decided that the order which they march should not be based on seniority but should be random. Bob thinks this is fine, and to be totally transparent he has communicated the following method he will use to create the marching list: He starts with an alphabetically ordered list of the professors in locations 0, 1, ..., n-1 and a random number m < 10^9. Then the first person in the marching list is the one in location m mod n in the alphabetic list. This shortens the alphabetic list by one, shifting down all those in positions greater than location m mod n. The second person in the marching list is the one in location m mod (n-1), and so on. For example, assume we have 6 professors A, B, C, D, E and F. If m = 11679, then the marching list is created as follows: n | m mod n | alphabetic list | marching list 6 | 3 | A B C D E F | D 5 | 4 | A B C E F | D F 4 | 3 | A B C E | D F E 3 | 0 | A B C | D F E A 2 | 1 | B C | D F E A C 1 | 0 | B | D F E A C B Write a program which takes as inout the marching order supposedly generated by the algorithm and determines whether it could have come from the algorithm and if so, what the smallest non-negative value of m could be. Input: the first line of input contains a single decimal integer, n (5 <= n <= 20), the number of professors who will be marching. The second line consists of a string containg a permutation of the first n capital leters, givving the proposed marching order. Output: If the string could not have come from the algorithm, the output is a single line containing the word NO. If there is an m, the first line of input contains the single word YES and the second line contains a decimal intefger giving the smallest non-negative value for m. Sample Input: Sample Output: 6 YES DFEACB 39 7 NO DFEGACB