Your task is to write a program that prints all the ways of placing rooks in a chessboard , in order to no rook threatens other one
The input is a sequence of at most naturals, each one between 1 and 7. The sequence ends in 0.
For each number of the input, your program must print all the ways to place rooks in a board , in order to no rook threatens other one. Remember that rooks move (and threaten) horizontally and vertically.
The different solutions must appear in lexicographical order. It is, between two solutions, appears first the one that has the first row rook more on the left. In a event of a tie, the second row is seen. If the tie persists, the third row is seen, etc.
The output has to follow the same format than the instance. The rooks
are indicated by a R, the empty positions with a dot. Your
program must print a line in white after each solution, and a line with
10 dashes after all the solutions for a
given.
Input
3 1 1 2 0
Output
R.. .R. ..R R.. ..R .R. .R. R.. ..R .R. ..R R.. ..R R.. .R. ..R .R. R.. ---------- R ---------- R ---------- R. .R .R R. ----------