Question description
It is known that the operators used by Martians are # and $, and their equivalent formulas to those on Earth are as follows:
- x#y = 4*x+3*y+2
- x$y = 2*x+y+3
- where x, y are unsigned integers
- Earthling formulas are calculated according to C language rules
- In the Martian formula, # has a higher priority than $, and the same operators are calculated from left to right.
There is a string message from Martians. Please translate it and calculate the result.
Enter description
Martian string expression (without carriage return and line feed at the end)
Description of the input string: The string is a calculation expression consisting only of unsigned integers and operators (#, $). For example:
123#4$5#67$78
- The use case ensures that there are no separators between operands and operators in the string.
- The use case ensures that the operand value range is a 32-bit unsigned integer.
- Ensure that input and calculation results will not cause integer overflow.
- Ensure that the input string is a legal evaluation message, for example: 123#4$5#67$78
- It is guaranteed that illegal evaluation messages will not appear, such as strings like this:
#4$5 //Missing operand
4$5# //Missing operand
4#$5 //Missing operand
4