Complement
Submissions: 1685   Accuracy:

28.07%

  Difficulty: Medium   Marks: 4

You are given a binary string S. In a single operation, you can choose two indices L and R such that 1 ≤ L ≤ R ≤ N and complement the characters between L and R i.e SL, SL+1, …, SR. By complement, we mean change character 0 to 1 and vice-versa.

You task is to perform ATMOST one operation such that in final string number of 1s is maximised. If there is no need to completement, i.e., string contains all 1s, return -1. Else, return the two values denoting L and R. If there are multiple solutions, return the lexicographically smallest pair of L and R.

 

Input:

The first line of input contains an integer T denoting the number of test cases.
Each test case consist of a length of string N and the next line contains the string S in 'lowercase' only.


Output:

Print the value L and R with space between then in a seprate line if it exists else print -1.


Constraints:

1 ≤ T ≤ 40
1 ≤ N ≤ 100
1 ≤ |s| ≤ 100

Example:

Input:
2
3
111
2
01
Output:
-1
1 1

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

Author: shef5


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.