Quiz
Smriti's String-2
Submissions: 1   Accuracy:

0%

  Max. Score:

30

Smriti is happy that you solved first question. So, she created a new problem for you to solve. Given a deck of cards, you have to form sub-deck of cards(maintaing original order). Sub-deck in the form that the sum of the numbers on the cards should be equal to or greater than to the sum of the adjacent right sub-Deck. Find the total number of possibilities of forming such decks.

Input:
First line consists of T test cases. Only line of test cases consists of string, string consisting only of numeric digits.

Output:
Single line output, print the required output.

Constraints:
1<=T=<=100
1<=|String length|<=25

Example:
Input:

3
52
57
1117
Output:
1
2
7

Explaination:
1st test case: [52] ; no right sub-deck with the greater sum can formed.
2nd test case: [57], [5-7] ; right sub-deck has the sum 7 which is greater that left sub-deck 5.
3rd test case:[1117], [1-117], [11-17], [111-7], [1-1-17], [1-11-7], [1-1-1-7]
[1-11-7]: right sub-deck with sum 7 is greater than the left sub-deck 11, which gives the sum 2, which is also greater than it's left sub-deck i.e. 1.


to report an issue on this page.