Given a string of digits, the task is to check if it is a ‘sum-string’. A string S is called a sum-string if a rightmost substring can be written as sum of two substrings before it and same is recursively true for substrings before it.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains a string S as input.
For each test case, print "1", if the string is sum-string else print "0".
In 1st test case "12243660" is a sum string. As we can get, 24 + 36 = 60 & 12 + 24 = 36 In 2nd test case "1111112223" is a sum string. As we can get, 111+112 = 223 & 1+111 = 112
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.