using System.Numerics; public class Program { public static void Main() { //int num = int.Parse(Console.ReadLine() ?? string.Empty); string[] str = (Console.ReadLine() ?? string.Empty).Trim().Split(' '); //string str = Console.ReadLine() ?? string.Empty; int n = int.Parse(str[0]); int k = int.Parse(str[1]); char[,] ints = new char[n, n]; for (int i = 0; i < n; i++) { string str2 = Console.ReadLine() ?? string.Empty; for (int j = 0; j < n; j++) { ints[i, j] = str2[j]; } } if (k == 1) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { Console.Write(ints[i, j]); } Console.WriteLine(); } } else { List list = new List(); for (int i = 0; i < n; i++) { for (int g = 0; g < k; g++) { for (int j = 0; j < n; j++) { for (int l = 0; l < k; l++) { list.Add(((char)ints[i, j])); } } } } int count = 0; for (int i = 1;i<= list.Count;i++) { Console.Write(list[count]); count++; if(i % (n*k) == 0) { Console.WriteLine(); } } } } }