#B3995. Constructing the Tian Character Matrix
Constructing the Tian Character Matrix
Constructing the Tian Character Matrix
Given an odd integer \(N\), your task is to construct an \(N \times N\) matrix representing a "Tian Character" (田字) pattern. The pattern follows these rules:
- The matrix has \(N\) rows and \(N\) columns. In each row, the first and last characters are always a vertical bar \(|\).
- For the first and last rows, all characters between the first and last (i.e. columns \(2\) to \(N-1\)) are a hyphen \(-\).
- In the middle row (i.e. row \(\frac{N+1}{2}\)), the characters in columns \(2\) to \(\frac{N-1}{2}\) and columns \(\frac{N+3}{2}\) to \(N-1\) are hyphens \(-\).
- In the middle column (i.e. column \(\frac{N+1}{2}\)), the characters in rows \(2\) to \(\frac{N-1}{2}\) and rows \(\frac{N+3}{2}\) to \(N-1\) are vertical bars \(|\).
- All other positions are filled with the lowercase letter \(x\).
For example, when \(N = 5\), the matrix is:
|---| |x|x| |-x-| |x|x| |---|
You need to print the matrix according to the above pattern.
inputFormat
The input consists of a single line containing an odd integer \(N\) (where \(N \ge 3\)).
outputFormat
Output the generated \(N \times N\) matrix. Each row should be printed on a separate line.
sample
3
|-|
|x|
|-|
</p>