Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Burrows and Scofield

By HillolTalukdar · Limits 1s, 512 MB

Michael Scofield and Lincoln Burrows are working on a secret mission. Michael is needed to give a secret number to his brother Lincoln. Since the mission is secret and the secret number should not be known to others so Michael gave two strings to his brother instead of that number!

For finding the secret number, first, Lincoln will take the first string and add all the numeric digits from that string. By this, he will get a number xx. Lincoln will do the same process for the second string, and he will get another number yy. Then Lincoln will get three numbers aa, bb, cc by adding, multiplying and subtracting xx and yy respectfully. For Subtraction, he will take the absolute value. The secret number is the second smallest number in aa, bb, cc.

Since, Lincoln is weak at mathematics, he hired you for finding the secret number.


The first line of input contains a string s1(1s150)s1 \hspace{.1cm} (1 \leq |s1| \leq 50).

The second line of input contains a string s2(1s250)s2 \hspace{.1cm} (1 \leq |s2| \leq 50).

Both strings contain only one word.


Print the secret number inside a double quotation.





s|s| denotes the length of the string ss.



94% Solution Ratio

Fazlerabbi.Earliest, Oct '20

Fazlerabbi.Fastest, 0.0s

Uosmoy383Lightest, 0 B

bokaifShortest, 131B


Login to submit

Toph uses cookies. By continuing you agree to our Cookie Policy.