using System;
using System.Text;
class AlphabetRangoli
{
// Function to generate and print the alphabet rangoli of size N
static void printAlphabetRangoli(int n)
{
if (n <= 0) return;
// Total width of the grid based on character and hyphen spacing
int total_width = 4 * n - 3;
// Loop from -(n-1) to (n-1) to handle top/bottom symmetry mathematically
for (int i = -(n - 1); i <= (n - 1); ++i)
{
int current_row_dist = Math.Abs(i); // Distance from the center row
StringBuilder line_chars = new StringBuilder();
// 1. Build the left/descending side of characters (e.g., e -> d -> c)
for (int j = 0; j < n - current_row_dist; ++j)
{
line_chars.Append((char)('a' + n - 1 - j));
}
// 2. Build the right/ascending side of characters (e.g., d -> e)
for (int j = n - current_row_dist - 2; j >= 0; --j)
{
line_chars.Append((char)('a' + n - 1 - j));
}
// 3. Insert hyphens between characters
StringBuilder standard_row = new StringBuilder();
for (int k = 0; k < line_chars.Length; ++k)
{
standard_row.Append(line_chars[k]);
if (k != line_chars.Length - 1)
{
standard_row.Append("-");
}
}
// 4. Calculate necessary hyphen padding for centering
int total_padding = total_width - standard_row.Length;
string side_hyphens = new string('-', total_padding / 2);
// 5. Print the complete constructed row
Console.WriteLine(side_hyphens + standard_row + side_hyphens);
}
}
static void Main()
{
int n = 5;
printAlphabetRangoli(n);
}
}
/*
run:
--------e--------
------e-d-e------
----e-d-c-d-e----
--e-d-c-b-c-d-e--
e-d-c-b-a-b-c-d-e
--e-d-c-b-c-d-e--
----e-d-c-d-e----
------e-d-e------
--------e--------
*/