406199: GYM102309 A APA of Orz Pandas
Description
An Orz Panda team is participating a programming contest. They solved a problem mathematically but then they realized that this problem requires arbitrarily precision arithmetic (APA).
The Orz Pandas are too lazy to write APA themselves. They decide to use Java but as all we know Java do not support operator overloading. Soon their expression evolves to a monster:
a.add(b).remainder(M).multiply(d.substract(e.multiply(f)).add(g.divide(h))).multiply (BigInteger.ValueOf(233)) ... ...
Now can you write a tool to help the Orz Pandas to translate a normal C++ arithmetic expression into a Java BigInteger arithmetic expression?
InputThe input file contains multiple test cases. Please process until EOF.
Each test case contains one line, including an arithmetic expression. It's guaranteed that this expression only contains identifiers, brackets, binary operators "+", "-", "*", "/", and "%". And all identifiers only contain English letters.
The length of the expression will not exceed 1000.
OutputOutput one line contains the Java BigInteger arithmetic expression.
This problem is not special judged so you should strictly keep the original ordering of the variables and evaluation, and do not add extra white spaces or brackets.
ExampleInputa+b+c (a+b)+c a+(b+c) (a+b)%(c+d)Output
a.add(b).add(c) a.add(b).add(c) a.add(b.add(c)) a.add(b).remainder(c.add(d))