182. Open the brackets
time limit per test: 0.25
sec.
memory limit per test: 4096
KB
input: standard
output: standard
There is a syntactically correct boolean expression.
The definition of syntactically correct expression follows as:
1) "a","b","c",...,"j" are syntactically correct expressions.
2) If A is a correct expression, then !A and (A) are correct expressions too.
3) If A is a correct expression and B is a correct expression, then AB, A&B, A<=>B, A=>B, A#B are syntactically correct expressions too.
Syntactically correct expression doesn't contain spaces.
Small Latin letters are variables, ! denotes negation,   disjunction, &  conjunction, <=>  equality, =>  implication, #  excepting or.
Negation has the highest priority, conjunction has middle priority, and other operations have low priority. Brackets change the order of operations executing.
Two expressions are called identical if their values are the same in any values of variables.
Make the expression, which will be identical with given expression. New expression must be free of brackets.
Input
Single line of input contains the correct expression; its length does not exceed 2048 symbols. Variables are denoted by small Latin letters from 'a' to 'j'.
Output
In the first line of output write the sought for expression. Its length must not exceed 32768 symbols.
Sample test(s)
Input
a&(bc)
Output
a&ba&c
Author:  Dmitry Orlov

Resource:  Saratov ST team Spring Contest #1

Date:  18.05.2003

Server time: 20171123 19:42:07  Online Contester Team © 2002  2016. All rights reserved. 

