In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you are familiar with IRC chat, the support team is also reachable on PIRC network (
#szkopul channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
After quite a lot of effort Bytie has finally managed to put rooks on a board of size so that no two of them attack each other. A quick reminder: a rook attacks all the fields of the board that are located in the same row or in the same column as it is1.
Unfortunately, the boy has now accidentally hit the board. As a result, several rooks have fallen down from it. Could you help Bytie put these rooks back on the board? The boy would like to leave the rooks that are still on the board intact.
The first line of the standard input contains one integer () that represents the size of the board. A description of the configuration of the rooks follows: the following lines contain characters each. The character '.' represents an empty field whereas the letter 'W' represents a field occupied by a rook.
You can assume that there are rooks on the board with and that no pair of rooks on the board attacks each other.
Your program should write to the standard output lines containing characters '.' or 'W' each: the final configuration of rooks on the board. The description should contain exactly occurrences of the letter 'W' with rooks placed in the same positions as in the initial board. No two rooks may attack each other. If there are multiple ways of placing rooks on the initial board, your program should output any one of them.
For the input data:
8 ........ .....W.. ..W..... .......W W....... ........ .W...... ........
the correct result is:
...W.... .....W.. ..W..... .......W W....... ....W... .W...... ......W.
Task author: Jakub Radoszewski.
1. See also http://en.wikipedia.org/wiki/Rook_(chess)