Given a binary string S. The task is to count the number of substrings that starts and end with 1. For example, if the input string is “00100101”, then there are three substrings “1001”, “100101” and “101”.
The first line contains T denoting the number of testcases. Then follows description of testcases. Each case contains a string S containing 0's and 1's.
For each test case, output a single line denoting number of substrings possible.
1 <= T <= 100
1 <= Length of String <= 100
Testcase 1: First substring from index 0 to 2 starts and ends with 1. Second substring starts from index 2 and ends at index 4. Last substring is the whole string from index 0 to 4.
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.