SP1455 ANALYSER - Program Analyser
Description
N/A
Input Format
A Program which has the following format:
```
::={}
::=
::= | | | |
::=+
::=?
::=GO
::=IF=
::=END
::=
::=
::={}
::=A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z
::= 0|1|2|3|4|5|6|7|8|9
::=(ASCII 10)
::=(ASCII 32)
```
The program runs following the following rules:
- Program starts from the sentence whose level is minimum, and executed by the level from low to high except that the sentence isor.
- All variables are initialized to 0.
- means+=in C++.
- means write the value ofto the output file(we aren't interesting about the real output file.)
- means if and only if the value of the equals to , will be executed, otherwise the next sentence executed is as usual.
- After, the next sentence executed is the sentence with level which equals to the level in.
- Program terminates by itself when is executed.
- The numbers during the program is running will fit in a signed 32-bit integer.
- The number of sentences in the program is not more than 100.
- The length of each line in the input file is not more than 20.
- The input is correct.
- The sentence with the maximum level is always .
- Any level is not more than 3000.
Output Format
Output the number of sentences executed.If the program can not terminate by itself,output -1.