#B3865. X-Shaped Matrix
X-Shaped Matrix
X-Shaped Matrix
Given an odd integer n, print an X-shaped matrix of size n x n where the two diagonals are filled with the character '+' and the remaining positions are filled with '-'.
More formally, for each cell \( (i,j) \) in the matrix (using 0-indexed rows and columns), if \( i = j \) or \( i+j = n-1 \), print '+', otherwise print '-'.
For example, when \( n = 5 \), the output should be:
+---+ -+-+- --+-- -+-+- +---+
inputFormat
The input consists of a single line containing an odd integer n (\( n \geq 1 \)).
outputFormat
Output the resulting X-shaped matrix with n rows, where each row is printed on a new line.
sample
1
+