Evaluate the x + a = b statement
Submissions: 1591   Accuracy:

22.77%

  Difficulty: Basic   Marks: 1

Given a string of form x + a = b where a and b are integer, find value of x [Note that spaces may or may not be there, for example, input can either be x+a=b or x + a = b or x+a = b].

For example if input string is x + 12 = 3 then output should be -9

 

Constraints:
1 <=T<= 30
1 <=a,b<= 1000

Example:
Input:

2
x+5=2
x+10=20

Output:
-3
10

 

** For More Input/Output Examples Use 'Expected Output' option **

Author: atharv


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.