#2008-37 Prefix expression evaluation

#2008-37 Prefix expression evaluation

Input

The input consists of multiple datasets, followed by a line which contains only a single ‘.’ (period). Each dataset represents a test data. Each dataset contains a prefix expression. The size of each line of an expression will be at most 1024. Each symbol or number is separated by at least one space.

Output

For each case, the output should indicate the calculation result of the input prefix expression. If the input expression is illegal, the output is the string “illegal”.

 

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *