using System; namespace BasicFormat { class Program { static int lineCount; static string indent; static void Main() { lineCount = int.Parse(Console.ReadLine()); string[] inputCode = new string[lineCount]; indent = Console.ReadLine(); int i = 0; string line; while (i < lineCount) { line = Console.ReadLine(); inputCode[i] = line; i++; } Console.Write(FormatCode(inputCode)); } static string FormatCode(string[] lines) { string result = ""; string emptyLine, startsWith; int indentLevel = 0; for (int i = 0; i < lineCount; i++) { emptyLine = string.Join("", lines[i].Split('»', '·')); startsWith = emptyLine.Split()[0]; if (startsWith == "ENDIF" || startsWith == "NEXT") { indentLevel -= 1; } for (int j = 0; j < indentLevel; j++) { result += indent; } result += emptyLine + "\n"; if (startsWith == "IF" || startsWith == "FOR") { indentLevel += 1; } } return result; } } }