import java.util.*;
public class Main {
public static void main (String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int nr = 2 * N - 1;
int nst = nr;
int nst1 = N -1;
int nsp = 1;
int nst2 = N-1;
//row work
int row = 1;
while(row<=nr)
{
if(row == 1 || row == nr)
{
for(int cst=1;cst<=nst;cst++)
{
System.out.print("*");
}
}
else
{
for(int cst = 1;cst<=nst1;cst++)
{
System.out.print("*");
}
for(int csp=1;csp<=nsp;csp++)
{
System.out.print(" ");
}
for(int cst=1;cst<=nst2;cst++)
{
System.out.print("*");
}
}
//preparation
System.out.println();
if(row>1 && row<nr)
{
if(row <= nr/2+1)
{
nst1 = nst1 - 1;
nsp = nsp + 2;
nst2 = nst2 - 1;
}
else
{
nst1 = nst1 + 1;
nsp = nsp - 2;
nst2 = nst2 + 1;
}
}
row = row + 1;
}
}
}
not getting the correct pattern
help ASAP