Please enter your email address or userHandle.
Given a string S consisting only '0's and '1's, print the last index of the '1' present in it.
First line of the input contains the number of test cases T, T lines follow each containing a stream of characters.
Corresponding to every test case, output the last index of 1. If 1 is not present, print "-1" (without quotes).
1 <= T <= 110
1 <= |S| <= 106
Testcase 1: Last index of 1 in given string is 4.
Testcase 2: Since, 1 is not present, so output is -1.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.