#K66247. Symmetrical Diamond
Symmetrical Diamond
Symmetrical Diamond
Given a positive integer \( n \) and a single character \( c \), create a symmetrical diamond shape with \( n \) levels. The diamond consists of a top half with \( n \) rows (including the middle row) and a bottom half with \( n-1 \) rows, forming a mirror image of the top half.
If the input is invalid (i.e. \( n \) is not a positive integer or \( c \) is not exactly one character), then output None
.
Note: The middle line of the diamond will contain \( 2n-1 \) characters. For example:
Input: 3 * Output: * *** ***** *** *
inputFormat
The input is provided via standard input (stdin) and consists of two lines. The first line contains an integer \( n \) representing the number of levels, and the second line contains a single character that is used to construct the diamond.
outputFormat
Output the diamond shape to standard output (stdout) such that each level appears on a new line. If the input is invalid, output None
. Ensure that there are no extra leading or trailing spaces on any line (except required spaces for shaping).
3
*
*
*
</p>