#t1140. 星号等腰三角形

星号等腰三角形

Isosceles Triangle of Stars

Problem Description

The right triangle from before only asked you to control how many stars each row printed; an isosceles triangle also needs leading spaces, which makes it a classic first exercise on nested loops: the outer loop walks over the rows, while the inner loops handle the spaces and then the stars of that row.

Concretely, for a triangle with nn rows, row ii (1≤i≤n1 \le i \le n) must:

  • print n−in-i spaces first;
  • then print 2i−12i-1 copies of *;
  • then move to the next line.

For example, with n=3n=3:

  *
 ***
*****

Read nn and print the corresponding isosceles triangle.

Input Format

One line containing a positive integer nn.

Output Format

nn lines forming the triangle exactly as described. The number of leading spaces on each line must follow the rule exactly.

Sample Input

3

Sample Output

  *
 ***
*****

Constraints

For 100% of the test data, 1≤n≤301 \le n \le 30.

Hint: you may write two nested loops, or think of it in terms of string(n - i, ' '). Note that the last row (row nn) has no leading spaces.