Write a program that prints “spirals” of size , as it is shown in the examples.
Input consists of a sequence of strictly positive natural numbers, ended with zero.
For each
,
print a spiral of size
.
Note that in the bottom row and in the right column there are only
‘X’s. Print an empty line after each spiral.
A matrix is not needed to solve this problem, but use it for simplicity.
Input
4 6 7 0
Output
.XXX .X.X ...X XXXX .XXXXX .X...X .X.X.X .XXX.X .....X XXXXXX .XXXXXX .X....X .X.XX.X .X..X.X .XXXX.X ......X XXXXXXX