Star Printing - 8

Interview

Time limit1sMemory limit128 MB

Summary
Print a diamond-like star pattern of width 2N where side star counts rise from 1 to N then fall back to 1, with spaces filling the middle.
Level

Easy2 of 10

Topics
Implementation, Simulation
Solved
No attempts yet

Problem

Given an integer N, print a star pattern of width 2N in 2N-1 lines. In the upper half, the number of stars on both sides increases from 1 to N while the gap in the middle decreases by two spaces each line. Then print the same shape in reverse for the lower half.

Input

The first line contains an integer N.

  • 1 ≤ N ≤ 100

Output

Print 2N-1 lines. For each line, let k be the number of stars printed on one side. Print k stars, then 2(N-k) spaces, then k stars. The value of k increases from 1 to N and then decreases from N-1 to 1.

Examples1

  1. Example 1

    Input
    5
    
    Expected output
    *        *
    **      **
    ***    ***
    ****  ****
    **********
    ****  ****
    ***    ***
    **      **
    *        *