An access-control policy is stored as a boolean expression string with no whitespace. Literals are T (true) and F (false). Operators are ! (logical NOT, a unary prefix), & (logical AND), and | (logical OR), and parentheses ( ) may group sub-expressions.
Precedence, from tightest to loosest, is !, then &, then |. The unary ! is right-associative (so !!T is !(!T)); & and | are left-associative. Parentheses override precedence. Evaluate the expression and report its truth value.
The expression is guaranteed to be syntactically valid.
Input format
A single line: the boolean expression (no whitespace), using only the characters T, F, !, &, |, (, ).
Output format
A single character: T if the expression evaluates to true, otherwise F.
Constraints
- 1 <= length of the expression <= 200
- The expression uses only
T,F,!,&,|,(,)and is syntactically valid.