This page is still under construction.

Parts of this page are still being built. What you see may change.

Star Pattern 17

Time limit1sMemory limit256 MB

Summary
Print a hollow isosceles triangle of height N, with stars on the two sides and a solid star base.
Level

Easy1 of 10

Topics
Implementation
Solved
No attempts yet

Problem

Draw the outline of a hollow isosceles triangle with stars (*) and spaces.

Given the height NN, build line ii (where 1≤i≤N1 \le i \le N) with this rule. Print N−iN - i spaces first, then one of the following.

  • If i=Ni = N, print 2N−12N - 1 stars in a row.
  • If i=1i = 1, print a single star.
  • On every other line, print one star, then 2i−32i - 3 spaces, then one more star.

When N=1N = 1, the first rule and the second rule produce the same line.

Input

The first line contains an integer NN. (1≤N≤1001 \le N \le 100)

Output

Print the lines built by the rule above in order, from the first line to line NN.

Examples4

  1. Example 1

    Input
    1
    
    Expected output
    *
    
  2. Example 2

    Input
    2
    
    Expected output
     *
    ***
  3. Example 3

    Input
    3
    
    Expected output
      *
     * *
    *****
  4. Example 4

    Input
    4
    
    Expected output
       *
      * *
     *   *
    *******