P27921 [洛谷] [GESP202403 Level 2] Xiao Yang's "Ri" Character Matrix
普及-
题目描述

Problem Description

Xiao Yang wants to construct a $N \times N$ "Ri" character matrix (where $N$ is an odd number). Specifically, this matrix has $N$ rows, each containing $N$ characters. The leftmost and rightmost columns are filled with the character |, while the first row, the last row, and the middle row (i.e., the $\frac{N+1}{2}$-th row) have the characters - in the positions from the 2nd to the $(N-1)$-th. All other characters are the lowercase letter x. For example, a "Ri" character matrix for $N = 5$ looks like this:

|---|
|xxx|
|---|
|xxx|
|---|

Please help Xiao Yang print the corresponding "Ri" character matrix based on the given $N$.

Input Format

A single line containing an integer $N$ ($5 \leq N \leq 49$, ensuring $N$ is an odd number).

Output Format

Output the corresponding "Ri" character matrix.

Please strictly adhere to the output format requirements. Do not add any extra spaces, punctuation, or other symbols. Your output should exactly match the standard answer to be considered correct. Ensure that you output exactly $N$ lines, each containing exactly $N$ characters, which can be either -, |, or x, excluding the newline characters.

Sample Input and Output

Sample Input #1

5

Sample Output #1

|---|
|xxx|
|---|
|xxx|
|---|

Sample Input #2

7

Sample Output #2

|-----|
|xxxxx|
|xxxxx|
|-----|
|xxxxx|
|xxxxx|
|-----|
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5
样例输出
|---| |xxx| |---| |xxx| |---|