Timer is Running

Sum-string
##### Submissions: 2424   Accuracy: 26.03%   Difficulty: Medium   Marks: 4

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.

Input:
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.

Output:
For each test case, print "1", if the string is sum-string else print "0".

Constraints:
1<=T<=100
1<=S<=105

Example:
Input:
3

12243660
1111112223
2368

Output:
1
1
0

Explanation:

``` 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```

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

Contributor: Arun Tyagi
Author: arun03

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.