#P1575. 正误问题

正误问题

Description

Xiao bobo became obsessed with Boolean operations. But after calculating until he got dizzy, he still could not figure it out. He turned to you for help to solve this problem.

Input Format

A string representing a logical expression, containing only true, false, or, and, not, and spaces (no parentheses and no xor). Operator precedence follows Pascal (from high to low: not, and, or), and within the same level evaluate from left to right. If the logical expression is invalid, output error.

Output Format

Output one line with the result: true or false. If the result cannot be determined, output error.

true or false and false
true

Hint

For all testdata, the input string length is less than 255255.

For this problem, the results true, false, and error each account for 13\dfrac{1}{3}; "cheating for points" is allowed, but it is not worth it because this is an "easy problem".


  • upd 2022.7.21\text{upd 2022.7.21}: Added 55 groups of Hack testdata.

Translated by ChatGPT 5