#P2715. Find the Unknown in an Arithmetic Equation
Find the Unknown in an Arithmetic Equation
Find the Unknown in an Arithmetic Equation
You are given an arithmetic equation of one of the following forms:
\(a \times b = c\) , \(a \div b = c\) , \(a + b = c\) , or \(a - b = c\)
In the equation, one of the three numbers \(a\), \(b\), or \(c\) is replaced by a question mark ?
to indicate it is unknown. Your task is to determine the value of the unknown quantity.
For example, if the input is ?+2=5
, then the unknown value is 3 since \(3+2=5\).
inputFormat
The input consists of a single line containing the equation as a string. The equation is always in one of the following forms: a*b=c
, a/b=c
, a+b=c
, or a-b=c
, where one of the numbers is replaced by ?
.
outputFormat
Output the value of the unknown number as an integer.
sample
?+2=5
3