SP3884 WHEN - When (You Believe)
Description
It's said: there can be miracles, when you believe. The following programming language shows the power of "when". It has a very simple (case insensitive) grammar, shown below:
```
PROGRAM := WHEN | PROGRAM WHEN
WHEN := 'when ' EXPRESSION STATEMENTS 'end when'
STATEMENTS := STATEMENT | STATEMENTS STATEMENT
STATEMENT := PRINT | SET
PRINT := 'print ' EXPRESSION_LIST
SET := 'set ' ASSIGNMENT_LIST
EXPRESSION_LIST := EXPRESSION | EXPRESSION_LIST ',' EXPRESSION
ASSIGNMENT_LIST := ASSIGNMENT | ASSIGNMENT_LIST ',' ASSIGNMENT
ASSIGNMENT := VARIABLE '=' EXPRESSION
EXPRESSION := '(' EXPRESSION OP EXPRESSION ')' | VARIABLE | NUMBER
OP := '
Input Format
The input consists of a single syntactically correct program. You may assume that the program will not execute more than 100000 set statements and 100000 print statements.
Output Format
Print the output produced by executing the given program. Both the input and output file will not exceed 100KB.