No tags yet

No tag edit access

time limit per test: 0.25 sec.

memory limit per test: 4096 KB

memory limit per test: 4096 KB

input: standard

output: 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 A||B, 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.

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 A||B, 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.

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'.

In the first line of output write the sought for expression. Its length must not exceed 32768 symbols.

Input

a&(b||c)

Output

a&b||a&c

Author: | Dmitry Orlov |

Resource: | Saratov ST team Spring Contest #1 |

Date: | 18.05.2003 |

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/25/2019 13:37:10 (f2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|