I wouldn't be posting the entire code here, but I can surely help.
This is how I would have had implemented the algorithm.
First, take input in a string STR.
Then break the string into 3 parts = NO1, NO2, ANS
Now check in each string, if it contains the string "machula"
Parse the string with "machula" as integer as solve the equation further.
For eg:
Taking sample test case 1:
Quote:
23 + 47 = machula
Then, split the input into 3 parts:
NO1 = 23
NO2 = 47
ANS = machula.
Checking each string for "machula" eliminates NO1 and NO2.
Let INT1, INT2, and INT3 be the Integer values of the strings.
Then:
INT1 = 23
INT2 = 47
And we have to find INT3.
Note: You can refer to
Converting Strings to Numbers in C/C++ - GeeksforGeeks[
^] to convert a string into an integer.