beecrowd | 1083
# LEXSIM - Sintatic and Lexical Avaliator

**Timelimit: 1**

By Neilor Tonin, URI Brazil

One of the most interesting use of stack is in evaluation of a mathematical expression. We can, through the stack, do the lexical analysis of the expression (indicating whether a valid expression has an invalid operand -a symbol which is not present in the table of operators or a symbol which is not present in the table of operands) and also the parsing. The parsing may indicate that it is missing one or more brackets, leaving one or more brackets, leaving the operator, two successive operands, etc.. The task here is to determine whether an expression is correct or is not correct.

In the input, are valid:

a) Operands: all uppercase and lowercase letters ('a'..'z', 'A'..'Z') and numbers (0...9).

b) Parenthesis.

c) Operators: all following operators in the priority table shown below are accepted:

Operator | Priority |
---|---|

^ | 6 |

*,/ | 5 |

+,- | 4 |

>,<,=,#, | 3 |

AND ( . ) | 2 |

OR ( | ) | 1 |

To make your job a little easier, you must use the point like AND (.) e the pipe like OR ( | ).

It won't be allowed expressions with unary operators. Example: 4 * -2

The end of input is determined by the end of file EOF().

As output, for each input expression should be generated a line indicating the result of processing. If the expression is correct, it should be transformed to the form posfix. If not possible, messages should be printed indicating Lexical Error or Syntax Error, in this order.

Input | Output |

( |
Syntax Error! |