#C5963. Concentric Rectangles Pattern
Concentric Rectangles Pattern
Concentric Rectangles Pattern
Given an odd integer \(n\), your task is to generate an \(n \times n\) grid that contains several concentric rectangular layers. The outermost layer forms a complete border of asterisks (*
).
Starting from the outer border, every alternate layer (i.e. layers with a gap of one layer in between) is drawn by placing asterisks along its border, while the intervening regions remain empty (filled with spaces). This creates an interesting pattern of nested rectangles.
For example, when \(n=5\), the expected pattern is:
***** * * * * * * * *****
Note: \(n\) is guaranteed to be an odd positive integer.
inputFormat
The input consists of a single odd integer \(n\) read from standard input.
outputFormat
Output the generated grid pattern. Each of the \(n\) rows must be printed on a new line to standard output.
## sample1
*
</p>