Solved by 159 users: ...
UserDateAttemptTimeCMSC
sb3ar`30 apr 2008`Ruby1800.0296
sb3ar`26 apr 2008`Ruby1700.0298
sb3ar`24 apr 2008`Ruby1500.02101
Madiyar_Tktl`18 jan 2014`Python2500.05190
ap_nayak`03 jan 2005`Python2?.??251
Madiyar_Tktl`18 jan 2014`Python700.05252
Fat`15 feb 2008`Ruby1700.02259
e2n`28 sep 2008`Python100.06259
lodin`30 sep 2007`Perl700.06261
zyxw`27 jan 2005`Python1?.??264
asp`13 jul 2007`C++100.01351
Aion256`29 apr 2011`C++500.01351
pekava1`31 dec 2010`C++200.01357
 C++ 90 FPC 26 C 12 Java 9 Kylix 9 Python 6 Ruby 4 Haskell 1 Scheme 1 Perl 1
` >  >  >  >  >  >  >  >  >  > `

## Disclosing of parentheses

Time limit = 1 second(s)

You should disclose parentheses in simple arithmetic expression without it's simplifying. This expression may consists of variables (characters from 'a' to 'z' in lower case), add signs ('+'), open and close parentheses ( '(' and ')' ), and multiplying without sings. For example:

(a+b)(c+d)e+f

You should know that

1) ab ≠ ba.

2) expand braces starting with the leftmost expression:

`(a+b)(c+d)  = ac + ad + bc + bd,`
but
`(a+b)(c+d) ≠ ac + bc + ad + bd.`

Input: One line with Expression. The expression has less then 200 characters.

Output: You should open parentheses and output the result. If there is an error in the input expression then output "#ERROR".

 Input#1```(a+b+c)(a+b+f) ``` Output#1```aa+ab+af+ba+bb+bf+ca+cb+cf ```
 Input#2```(a+c)ab ``` Output#2```aab+cab ```
 Input#3```() ``` Output#3
 Input#4```(+a) ``` Output#4```#ERROR ```
 Input#5```((a) ``` Output#5```#ERROR ```

Author:
Semi-final of Ukraine student olympiad, Khmelnitsky, march 2003.
24 april 2003

 © acm.mipt DevGroupThe page was generated in 220ms