{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eLet\u0027s analyze a program written on some strange programming language. The variables in this language have names consisting of $$$1$$$ to $$$4$$$ characters, and each character is a lowercase or an uppercase Latin letter, or a digit. There is an extra constraint that the first character should not be a digit.\u003c/p\u003e\u003cp\u003eThere are four types of operations in the program, each denoted by one of the characters: \u003cspan class\u003d\"tex-font-style-tt\"\u003e$\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003e^\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003e#\u003c/span\u003e or \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u0026amp;\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eEach line of the program has one of the following formats: \u003c/p\u003e\u003cul\u003e \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u0026lt;lvalue\u0026gt;\u003d\u0026lt;rvalue\u0026gt;\u003c/span\u003e, where \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u0026lt;lvalue\u0026gt;\u003c/span\u003e and \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u0026lt;rvalue\u0026gt;\u003c/span\u003e are valid variable names; \u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u0026lt;lvalue\u0026gt;\u003d\u0026lt;arg1\u0026gt;\u0026lt;op\u0026gt;\u0026lt;arg2\u0026gt;\u003c/span\u003e, where \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u0026lt;lvalue\u0026gt;\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u0026lt;arg1\u0026gt;\u003c/span\u003e and \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u0026lt;arg2\u0026gt;\u003c/span\u003e are valid variable names, and \u0026lt;op\u0026gt; is an operation character. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe program is executed line-by-line, and the result of execution is stored in a variable having the name \u003cspan class\u003d\"tex-font-style-tt\"\u003eres\u003c/span\u003e. If \u003cspan class\u003d\"tex-font-style-tt\"\u003eres\u003c/span\u003e is never assigned in the program, then the result will be equal to the value of \u003cspan class\u003d\"tex-font-style-tt\"\u003eres\u003c/span\u003e before running the program.\u003c/p\u003e\u003cp\u003eTwo programs are called equivalent if no matter which operations do characters \u003cspan class\u003d\"tex-font-style-tt\"\u003e$\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003e^\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003e#\u003c/span\u003e and \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u0026amp;\u003c/span\u003e denote (but, obviously, performing the same operation on the same arguments gives the same result) and which values do variables have before execution of program, the value of \u003cspan class\u003d\"tex-font-style-tt\"\u003eres\u003c/span\u003e after running the first program is equal to the value of \u003cspan class\u003d\"tex-font-style-tt\"\u003eres\u003c/span\u003e after running the second program (the programs are executed independently).\u003c/p\u003e\u003cp\u003eYou are given a program consisting of $$$n$$$ lines. Your task is to write a program consisting of minimum possible number of lines that is equivalent to the program you are given.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains one integer $$$n$$$ ($$$1 \\le n \\le 1000$$$) — the number of lines in the program.\u003c/p\u003e\u003cp\u003eThen $$$n$$$ lines follow — the program itself. Each line corresponds to the format described in the statement and has no extra whitespaces.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eIn the first line print $$$k$$$ — the minimum number of lines in the equivalent program.\u003c/p\u003e\u003cp\u003eThen print $$$k$$$ lines without any whitespaces — an equivalent program having exactly $$$k$$$ lines, in the same format it is described in the statement.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\nc\u003daa#bb\nd12\u003dc\nres\u003dc^d12\ntmp\u003daa$c\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\naaaa\u003daa#bb\nres\u003daaaa^aaaa\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\nmax\u003daaaa$bbbb\nmin\u003dbbbb^aaaa\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}