using System;
class HelloWorld
{
    static void Main()
    {
        string v_u = ("MAKSIMS GUTOVS"); // tik izveidots mainigais ar manu vardu un uzvardu
        v_u = v_u.ToLower();
        string[] sadalits = v_u.Split(' '); // izveidots massivs (0-Maksims, 1-Gutovs)
        string vards = (sadalits[0]);
        string uzvards = (sadalits[1]);
        int i = 0;
        Console.Write("Mans vards: ");
        vards = vards.ToUpper();

        // Varda izvadisana
        do  // tik izvadita pirva LIELA burta
        {
            Console.Write($"{vards[i]}");
        }
        while (i != 0);
        vards = vards.ToLower();
        for (i = 1; i < vards.Length; i++) // tik izvaditi vissi citi burti cikliska veida
        {
            Console.Write($"{vards[i]}");
        }
        Console.WriteLine();

        // Uzvarda izvadisana
        Console.Write("Mans uzvards: ");
        uzvards = uzvards.ToUpper();
        i = 0;
        do  // tik izvadita pirva LIELA burta
        {
            Console.Write($"{uzvards[i]}");
        }
        while (i != 0);
        uzvards = uzvards.ToLower();
        for (i = 1; i < vards.Length - 1; i++) // tik izvaditi vissi citi burti cikliska veida
        {
            Console.Write($"{uzvards[i]}");
        }
        Console.WriteLine();

        // tabulu veidosana
        Console.Write("Ievadiet kolonu skailtu, ne mazak par 5: ");
        int kol = Convert.ToInt32(Console.ReadLine());  // noradits kolonu skaits

        // tabulas cikls
        for (int j = 1; j <= kol; j++)
        {
            int n_tuks = kol - j;
            {
                // tuksuma cikls
                for (int j1 = n_tuks; j1 > 0; j1--)
                {
                    Console.Write("\t");
                }
                // noformesanas cikls +---+
                if (j <= kol)
                {
                    for (int j2 = j; j2 > 0; j2--)
                    {
                        Console.Write("+-------");
                    }
                }
                else
                    for (int j2 = kol; j2 > 0; j2--)
                    {
                        Console.Write("+-------");
                    }
                Console.Write("+");
                Console.WriteLine();
                // atkal tuksuma cikls
                for (int j1 = n_tuks; j1 > 0; j1--)
                {
                    Console.Write("\t");
                }
                Console.Write("|   ");
                // skailta izvadisanas cikls
                if (j <= kol)
                {
                    for (int j2 = 1; j2 <= j; j2++)
                    {
                        Console.Write(j2 + "   |   ");
                    }
                }
                else
                    for (int j2 = j - kol + 1; j2 <= j; j2++)
                    {
                        Console.Write(j2 + "   |   ");
                    }
                Console.WriteLine();

            }
        }
        // noformesanas cikls +---+
        for (int b = 1; b <= kol; b++)
        {
        Console.Write("+-------");
        }
        Console.WriteLine("+");
        // tabulas cikls
        for (int a = 1; a <= kol; a++)
        {
            // skailta izvadisanas cikls
            for (int a1 = 1; a1 <= a; a1++)
            {
                Console.Write("|   ");
                Console.Write(a1 + "   ");
            }
            Console.WriteLine("|");
            // noformesanas cikls +---+
            for (int a2 = 1; a2 <= a; a2++)
            {
                Console.Write("+-------");
            }
            if (a != kol)
            {
                Console.Write("+-------");
            }
            Console.WriteLine("+");
        }

    }
}
