You are given a binary string str. 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 str_{L}, str_{L+1}, , str_{R}. 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.
Example 1:
Input:
N = 3
str = "111"
Output: -1
Explanation: As all characters are '1', 
so don't need to complement any.
Example 2:
Input:
N = 2
str = "01"
Output: 1 1
Explanation: After complementing [1, 1] 
the string becomes "11".
Your Task:
You don't need to read input or print anything. Complete the function findRange() which takes the string str and the size of the string, n, as input parameters and returns an array of length 2 or 1 representing the answer. 
You don't have to print answer or take inputs.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N ≤ 10^{5}
Str is a binary string i.e. contains only '0' and '1'.

Difficulty: MEDIUM
Tags: Data structures
Skill types: Data structures
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:



	def findRange(self,a, size):

    	# code here

Solutions:
class Solution:

	def findRange(self, a, size):
		arr = [1 if i == '0' else -1 for i in a]
		(l, r, res) = (0, 0, [0, 0])
		(cursum, maxsum) = (0, float('-inf'))
		for i in range(len(arr)):
			if arr[i] > arr[i] + cursum:
				l = i
				cursum = arr[i]
			else:
				cursum = arr[i] + cursum
			r = i
			if cursum > maxsum:
				maxsum = cursum
				res = [l + 1, r + 1]
		return res if maxsum >= 0 else [-1]


class Solution:

	def findRange(self, a, size):
		if a.count('1') == size:
			return [-1]
		arr = []
		for i in a:
			if i == '1':
				arr.append(-1)
			else:
				arr.append(1)
		maxi = 0
		maxcurr = 0
		l = 0
		r = 0
		curr = 0
		for i in range(size):
			maxcurr += arr[i]
			if maxcurr < 0:
				maxcurr = 0
				curr = i + 1
			elif maxi < maxcurr:
				maxi = maxcurr
				l = curr
				r = i
		else:
			return [l + 1, r + 1]


class Solution:

	def findRange(self, a, size):
		if a.count('1') == size:
			return [-1]
		arr = []
		for i in a:
			if i == '1':
				arr.append(-1)
			else:
				arr.append(1)
		mxtill = 0
		mxhere = 0
		f = 0
		l = 0
		g = 0
		for j in range(size):
			mxhere += arr[j]
			if mxhere < 0:
				mxhere = 0
				f = j + 1
			elif mxtill < mxhere:
				mxtill = mxhere
				g = j
				l = f
		else:
			return [l + 1, g + 1]


class Solution:

	def findRange(self, a, size):
		(start, end) = (0, 0)
		curr = 1
		(minstart, maxend) = (-1, -1)
		max_change = 0
		while end < size:
			if a[end] == '0':
				curr *= 2
				end += 1
				if curr > max_change:
					max_change = curr
					minstart = start
					maxend = end
			elif curr // 2 > 0:
				curr //= 2
				end += 1
			else:
				curr = 1
				end += 1
				start = end
		if minstart == -1 or maxend == -1:
			return (-1,)
		return (minstart + 1, maxend)


from sys import maxsize

class Solution:

	def findRange(self, a, size):
		max_so_far = -maxsize - 1
		max_ending_here = 0
		start = 0
		end = 0
		s = 0
		ans = []
		allOne = True
		for x in a:
			if x == '0':
				allOne = False
		if allOne:
			ans.append(-1)
			return ans
		for i in range(0, size):
			max_ending_here += -1 if a[i] == '1' else 1
			if max_so_far < max_ending_here:
				max_so_far = max_ending_here
				start = s
				end = i
			if max_ending_here < 0:
				max_ending_here = 0
				s = i + 1
		ans.append(start + 1)
		ans.append(end + 1)
		return ans


class Solution:

	def findRange(self, a, size):
		s = 0
		ans = 0
		l = 0
		L = -1
		for i in range(n):
			if a[i] == '0':
				r = i
				s += 1
			else:
				s -= 1
				r = i
			if s < 0:
				s = 0
				if i + 1 < n:
					l = i + 1
			if s > ans:
				ans = s
				L = l
				R = r
		if L == -1:
			res = [-1]
		else:
			res = [L + 1, R + 1]
		return res


class Solution:

	def findRange(self, a, size):
		maxi = 0
		summa = 0
		mini = 0
		start = 1
		output = [-1]
		for i in range(size):
			if a[i] == '1':
				summa += 1
				if summa > maxi:
					maxi = summa
					start = i + 2
			else:
				summa -= 1
				if summa - maxi < mini:
					output = [start, i + 1]
					mini = summa - maxi
		return output


class Solution:

	def findRange(self, a, size):
		c = 0
		M = 0
		B = []
		L = 0
		R = -1
		f = 0
		x = L
		y = R
		for i in range(size):
			if a[i] == '0':
				c += 1
				f = 1
				R += 1
			else:
				if c > M:
					M = c
					x = L
					y = R
				R += 1
				c -= 1
				if c < 0:
					c = 0
					L = i + 1
					R = i
		if c > M:
			M = c
			x = L
			y = R
		if f == 0:
			return [-1]
		return [x + 1, y + 1]


class Solution:

	def findRange(self, a, size):
		max_sum = 0
		cur_sum = 0
		s = 0
		(left, right) = (None, None)
		for i in range(len(a)):
			cur = 1 if a[i] == '0' else -1
			cur_sum += cur
			if cur_sum < 0:
				cur_sum = 0
				s = i + 1
			if cur_sum > max_sum:
				left = s
				right = i
				max_sum = cur_sum
		return [left + 1, right + 1] if left != None else [-1]


class Solution:

	def findRange(self, a, size):
		total = 0
		curr_count = 0
		l = 0
		ans = [-1]
		for (r, c) in enumerate(a):
			if c == '1':
				curr_count -= 1
			if c == '0':
				curr_count += 1
			if curr_count > total:
				total = curr_count
				ans = [l + 1, r + 1]
			if curr_count < 0:
				curr_count = 0
				l = r + 1
		return ans


class Solution:

	def findRange(self, a, size):
		s = 0
		st = 0
		L = 0
		R = 0
		f = 0
		list1 = []
		if '0' not in a:
			list1.append(-1)
			return list1
		for i in range(0, len(a)):
			if a[i] == '1':
				s = s - 1
			else:
				s = s + 1
			if f == 0:
				m = s
				f = 1
				L = i
				R = st
				f = 1
			elif s > m:
				m = s
				L = i
				R = st
			if s < 0:
				s = 0
				st = i + 1
		list1 = []
		list1.append(R + 1)
		list1.append(L + 1)
		return list1


class Solution:

	def findRange(self, s, n):
		cmax = cnt = 0
		l = r = 1
		ans = [-1]
		for i in range(n):
			cnt += 1 if s[i] == '0' else -1
			if cnt > cmax:
				cmax = cnt
				r = i + 1
				ans = (l, r)
			if cnt < 0:
				cnt = 0
				l = i + 2
		return ans


class Solution:

	def findRange(self, a, n):
		ml = 0
		cl = 0
		k = 0
		f = 0
		l = 0
		for i in range(n):
			if a[i] == '0':
				cl += 1
			else:
				cl -= 1
			if cl < 0:
				cl = 0
				k = i + 1
			if ml < cl:
				ml = cl
				f = k
				l = i
		if ml == 0:
			return [-1]
		return [f + 1, l + 1]


class Solution:

	def findRange(self, a, n):
		if a.count('1') == n:
			return [-1]
		arr = []
		for i in a:
			if i == '1':
				arr.append(-1)
			else:
				arr.append(1)
		maxtill = 0
		maxhere = 0
		f = 0
		s = 0
		e = 0
		for j in range(n):
			maxhere += arr[j]
			if maxhere < 0:
				maxhere = 0
				f = j + 1
			elif maxtill < maxhere:
				maxtill = maxhere
				e = j
				s = f
		return [s + 1, e + 1]


class Solution:

	def findRange(self, a, size):
		s = 0
		ml = 0
		fs = -1
		fe = -1
		cl = 0
		for i in range(size):
			if a[i] == '0':
				cl += 1
			else:
				cl -= 1
			if cl < 0:
				s = i + 1
				cl = 0
			if cl > ml:
				fs = s
				fe = i
				ml = cl
		if fs == -1:
			return [-1]
		else:
			return [fs + 1, fe + 1]


class Solution:

	def findRange(self, a, n):
		left_max = -1
		left_cur = 0
		right_max = -1
		right_cur = -1
		sum_max = 0
		sum_cur = 0
		for i in range(n):
			if a[i] == '1':
				sum_cur -= 1
			else:
				sum_cur += 1
			if sum_cur < 0:
				sum_cur = 0
				left_cur = i + 1
			if sum_cur > sum_max:
				sum_max = sum_cur
				left_max = left_cur
				right_max = i
		if sum_max == 0:
			return [-1]
		return (left_max + 1, right_max + 1)


class Solution:

	def findRange(self, a, size):
		max_value = 0
		max_so_far = 0
		ans = ''
		arr = []
		item = 0
		fl = fr = -1
		r = 0
		l = 0
		ct = 1
		for i in range(size):
			if int(a[i]) == 1:
				item = -1
				max_so_far -= 1
			elif int(a[i]) == 0:
				r = i
				item = 1
				max_so_far += 1
			if max_so_far > max_value:
				fl = l + ct
				fr = r + 1
				max_value = max_so_far
			if max_so_far < 0:
				max_so_far = 0
				l = i
				ct = 2
		if fl == -1:
			return ['-1']
		else:
			if fr == 0:
				return [fl, fl]
			return [fl, fr]


class Solution:

	def findRange(self, a, size):
		n = len(a)
		best_l = None
		best_r = None
		l = 0
		arr = []
		for b in a:
			if b == '0':
				arr.append(-1)
			else:
				arr.append(1)
		min_so_far = 0
		min_ending_here = 0
		for (i, b) in enumerate(arr):
			min_ending_here += b
			if min_ending_here < min_so_far:
				best_l = l
				best_r = i
				min_so_far = min_ending_here
			if min_ending_here > 0:
				min_ending_here = 0
				l = i + 1
		if best_l is not None and best_r is not None:
			return [best_l + 1, best_r + 1]
		else:
			return [-1]


class Solution:

	def findRange(self, a, size):
		n = len(a)
		best_l = None
		best_r = None
		best_improvement = 0
		l = 0
		cur_sum = 0
		for (r, b) in enumerate(a):
			if b == '1':
				cur_sum += 1
				continue
			improvement = r - l + 1 - 2 * cur_sum
			if improvement <= 0:
				l = r
				cur_sum = 0
				improvement = 1
			if improvement > best_improvement:
				best_improvement = improvement
				best_l = l
				best_r = r
		if best_l is not None and best_r is not None:
			return [best_l + 1, best_r + 1]
		else:
			return [-1]


class Solution:

	def findRange(self, a, s):
		(ans, t) = (float('-inf'), 0)
		arr = []
		res = []
		j = 0
		f = 0
		for i in a:
			if i == '0':
				arr.append(1)
				f = 1
			else:
				arr.append(-1)
		if f == 0:
			return [-1]
		for i in range(s):
			t += arr[i]
			if ans < t:
				ans = t
				res = [j, i]
			if t < 0:
				j = i + 1
				t = 0
		return (res[0] + 1, res[1] + 1)


class Solution:

	def findRange(self, s, n):
		start = -1
		end = -1
		l = 0
		currentCount = 0
		maxCount = 0
		for i in range(0, n):
			if s[i] == '0':
				currentCount += 1
			else:
				currentCount -= 1
			if currentCount < 0:
				l = i + 1
				currentCount = 0
			elif currentCount > maxCount:
				maxCount = currentCount
				start = l
				end = i
		if end == -1:
			return [-1]
		return [start + 1, end + 1]


class Solution:

	def findRange(self, a, size):
		x = [int(i) for i in a]
		zero = 0
		one = 0
		for i in range(len(x)):
			if x[i] == 0:
				zero = zero + 1
		if zero == 0:
			return [-1]
		sum0 = 0
		max1 = 0
		L = 0
		R = 0
		st = 0
		for i in range(len(x)):
			if x[i] == 1:
				sum0 = sum0 - 1
			else:
				sum0 = sum0 + 1
			if sum0 > max1:
				L = st
				R = i
				max1 = sum0
			if sum0 < 0:
				st = i + 1
				sum0 = 0
		return [L + 1, R + 1]


class Solution:

	def findRange(self, a, size):
		count = 0
		l = -1
		r = -1
		maxcount = 0
		maxl = -1
		maxr = -1
		for i in range(len(a)):
			if a[i] == '0':
				count += 1
			elif a[i] == '1':
				count -= 1
			if count < 0:
				count = 0
				l = -1
				r = -1
			if count == 1 and l == -1:
				l = i
				r = i
			elif count >= 0:
				r += 1
			if count > maxcount:
				maxcount = count
				maxl = l
				maxr = r
		if maxl == -1 and maxr == -1:
			return [-1]
		else:
			return [maxl + 1, maxr + 1]


class Solution:

	def findRange(self, a, size):
		(left, sl) = (0, 0)
		(right, sr) = (0, 0)
		noZero = True
		totalZero = 0
		maxValue = 0
		for i in range(0, size):
			if a[i] == '0':
				noZero = False
				totalZero += 1
			else:
				totalZero -= 1
			if totalZero < 0:
				totalZero = 0
				left = i + 1
			if totalZero > maxValue:
				maxValue = totalZero
				sl = left
				sr = right
			right += 1
		if noZero:
			return (-1,)
		else:
			return (sl + 1, sr + 1)


class Solution:

	def findRange(self, a, n):
		l = 0
		lm = 0
		gm = 0
		left = 0
		r = -1
		for i in range(n):
			if a[i] == '0':
				x = 1
			else:
				x = -1
			if lm < 0:
				if x == 1:
					l = i
					lm = x
			else:
				lm += x
			if lm > gm:
				gm = lm
				left = l
				r = i
		if r == -1:
			return [-1]
		return [left + 1, r + 1]


class Solution:

	def findRange(self, a, n):
		max1 = 0
		la = -1
		ra = -1
		ct = 0
		laa = -1
		raa = -1
		for i in range(n):
			if a[i] == '0':
				ct = ct + 1
				ra = i
			else:
				ct = ct - 1
			if ct < 0:
				ct = 0
				la = i
			if max1 < ct:
				max1 = ct
				laa = la + 1
				raa = ra
		if laa == -1:
			return [-1]
		return [laa + 1, raa + 1]


class Solution:

	def findRange(self, a, size):
		curSum = 0
		maxSum = 0
		l = 0
		r = 0
		ans = [-1, -1]
		for i in range(0, size):
			if a[i] == '1':
				curSum -= 1
			else:
				curSum += 1
			if curSum > maxSum:
				maxSum = curSum
				ans[0] = l + 1
				ans[1] = r + 1
			if curSum < 0:
				curSum = 0
				l = i + 1
				r = i + 1
			else:
				r += 1
		if maxSum == 0:
			ans = [-1]
			return ans
		else:
			return ans


class Solution:

	def findRange(self, A, size):
		cur = 0
		maxx = 0
		l = 0
		r = 0
		ans = [-1, -1]
		for i in range(0, len(A)):
			if A[i] == '1':
				cur -= 1
			else:
				cur += 1
			if cur > maxx:
				ans[0] = l + 1
				ans[1] = r + 1
				maxx = cur
			if cur < 0:
				cur = 0
				l = i + 1
				r = i + 1
			else:
				r += 1
		if maxx == 0:
			return [-1]
		else:
			return ans


class Solution:

	def findRange(self, s, n):
		if set(s) == {'1'}:
			return [-1]
		(left, right) = (1, 1)
		z = 0
		(sl, sr) = (1, 1)
		mx = 0
		for i in range(n):
			if s[i] == '0':
				z += 1
			else:
				z -= 1
			if z > mx:
				mx = z
				sl = left
				sr = right
			if z < 0:
				z = 0
				left = i + 2
			right += 1
		return [sl, sr]


class Solution:

	def findRange(self, a, size):
		delta = [0] * size
		(zeros, ones) = (0, 0)
		for (i, bit) in enumerate(a):
			zeros += int(bit == '0')
			ones += int(bit == '1')
			delta[i] = zeros - ones
		min_ref = (0, -1)
		max_diff = (float('-inf'), -1, -1)
		for (i, d) in enumerate(delta):
			if d - min_ref[0] > max_diff[0]:
				max_diff = (d - min_ref[0], min_ref[1], i)
			if d < min_ref[0]:
				min_ref = (d, i)
		if max_diff[0] <= 0:
			return (-1,)
		(i, j) = (max_diff[1] + 2, max_diff[2] + 1)
		if 1 <= i <= j <= size:
			return (i, j)
		else:
			return (-1,)


class Solution:

	def findRange(self, a, size):
		flag = 0
		for val in a:
			if val == '0':
				flag = 1
		if flag == 0:
			return [-1]
		count = 0
		N = len(a)
		l = 0
		maxCnt = 0
		(left, right) = (0, 0)
		for r in range(N):
			if a[r] == '0':
				count += 1
			else:
				count -= 1
			if count < 0:
				count = 0
				l = r + 1
			if count > maxCnt:
				maxCnt = count
				right = r
				left = l
		return [left + 1, right + 1]


class Solution:

	def findRange(self, s, N):
		s = list(s)
		for i in range(N):
			if s[i] == '1':
				s[i] = -1
			else:
				s[i] = 1
		(cur, mx) = (-1, -1)
		(l, r) = (-1, -1)
		res = [-1]
		for (i, n) in enumerate(s):
			cur += n
			if n > cur:
				cur = n
				l = i
			if cur > mx:
				mx = cur
				r = i
				res = [l + 1, r + 1]
		return res


class Solution:

	def findRange(self, a, size):
		maxZeros = -1
		countZeros = 0
		L = -1
		R = -1
		tmpL = -1
		for i in range(size):
			if a[i] == '0':
				countZeros += 1
			else:
				countZeros -= 1
			if maxZeros < countZeros:
				maxZeros = countZeros
				L = tmpL + 1
				R = i
			if countZeros < 0:
				countZeros = 0
				tmpL = i
		return [-1] if L == -1 else [L + 1, R + 1]


import sys

class Solution:

	def findRange(self, a, size):
		c = 0
		m = -sys.maxsize
		if a.count('1') == size:
			return [-1]
		li = [0] * size
		for i in range(size):
			if a[i] == '0':
				li[i] = 1
			else:
				li[i] = -1
		a = li
		(l, r) = (-1, -1)
		st = -1
		for i in range(size):
			c += int(a[i])
			if m < c:
				m = c
				st = l + 1
				r = i
			if c < 0:
				c = 0
				l = i
		return [st + 1, r + 1]


class Solution:

	def findRange(self, a, size):
		a = list(a)
		for i in range(size):
			if a[i] == '0':
				a[i] = 1
			else:
				a[i] = -1
		ans = [0, 0]
		gmax = float('-inf')
		lmax = 0
		l = 0
		r = 0
		for i in range(size):
			if a[i] > a[i] + lmax:
				l = i
				r = i
				lmax = a[i]
			else:
				r = i
				lmax = a[i] + lmax
			if gmax < lmax:
				gmax = lmax
				ans = [l + 1, r + 1]
		if gmax < 0:
			return [-1]
		return ans


class Solution:

	def findRange(self, a, size):
		result = [-1, -1, 0]
		cnt_one = 0
		cnt_comp1 = 0
		i = 0
		j = 0
		while True:
			f1 = False
			f2 = False
			while j < size and cnt_one <= cnt_comp1:
				if int(a[j]) == 1:
					cnt_one += 1
				else:
					cnt_comp1 += 1
				if cnt_one < cnt_comp1:
					if cnt_comp1 - cnt_one > result[2]:
						result[0] = i + 1
						result[1] = j + 1
						result[2] = cnt_comp1 - cnt_one
				j += 1
				f1 = True
			if cnt_one < cnt_comp1:
				if cnt_comp1 - cnt_one > result[2]:
					result[0] = i + 1
					result[1] = j
					result[2] = cnt_comp1 - cnt_one
				if result[0] == -1 and result[1] == -1:
					return [-1]
				else:
					return result[:2]
			while i <= j and cnt_comp1 < cnt_one:
				if int(a[i]) == 1:
					cnt_one -= 1
				else:
					cnt_comp1 -= 1
				i += 1
				f2 = True
			if f1 == False and f2 == False:
				break
		if result[0] == -1 and result[1] == -1:
			return [-1]
		else:
			return result[:2]


class Solution:

	def findRange(self, a, size):
		(l, r, curr_cnt, max_cnt, start) = (-1, -1, 0, 0, 0)
		for i in range(size):
			curr_cnt += 1 if a[i] == '0' else -1
			if curr_cnt > max_cnt:
				max_cnt = curr_cnt
				l = start
				r = i
			if curr_cnt < 0:
				curr_cnt = 0
				start = i + 1
		if l == -1:
			return [l]
		return [l + 1, r + 1]


class Solution:

	def findRange(self, a, size):
		local_max = 0
		l = 0
		global_max = 0
		right = -1
		left = 0
		for i in range(0, size):
			if a[i] == '0':
				num = 1
			else:
				num = -1
			if local_max < 0:
				if num == 1:
					l = i
					local_max = num
			else:
				local_max += num
			if local_max > global_max:
				global_max = local_max
				left = l
				right = i
		if right == -1:
			return [-1]
		else:
			return [left + 1, right + 1]


class Solution:

	def findRange(self, arr, size):
		ans = [-1]
		total = 0
		count = 0
		low = 0
		for (j, i) in enumerate(arr):
			if i == '0':
				count += 1
			if i == '1':
				count -= 1
			if count > total:
				ans = [low + 1, j + 1]
				total = count
			if count < 0:
				count = 0
				low = j + 1
		return ans


class Solution:

	def findRange(self, a, size):
		l = -1
		r = -1
		ansL = -1
		ansR = -1
		count = 0
		maxx = 0
		li = []
		for i in range(size):
			if a[i] == '0':
				count += 1
			else:
				count -= 1
				if count < 0:
					count = 0
					l = -1
			if count == 1 and l == -1:
				l = i
			if count > maxx:
				maxx = count
				ansL = l + 1
				ansR = i + 1
		if ansL == -1:
			li.append(-1)
		else:
			li.append(ansL)
			li.append(ansR)
		return li
if __name__ == '__main__':
	tc = int(input())
	while tc > 0:
		n = int(input())
		s = input()
		ob = Solution()
		ans = ob.findRange(s, n)
		if len(ans) == 1:
			print(ans[0])
		else:
			print(str(ans[0]) + ' ' + str(ans[1]))
		tc = tc - 1


class Solution:

	def findRange(self, a, size):
		tot = 0
		curr = 0
		l = 0
		ans = [-1]
		for (r, c) in enumerate(a):
			if c == '1':
				curr -= 1
			if c == '0':
				curr += 1
			if curr > tot:
				tot = curr
				ans = [l + 1, r + 1]
			if curr < 0:
				curr = 0
				l = r + 1
		return ans


class Solution:

	def findRange(self, a, size):
		L = -1
		R = -1
		templ = -1
		tempr = -1
		zero = 0
		lastzero = 0
		i = 0
		while i < len(a):
			if a[i] == '0':
				if templ == -1:
					templ = i
				zero += 1
				if zero > lastzero:
					tempr = i
					lastzero = zero
			if zero > 0 and a[i] == '1':
				zero -= 1
				if zero == 0 and templ != -1 and (tempr != -1):
					L = templ
					R = tempr
			elif zero == 0 and a[i] == '1':
				templ = -1
				tempr = -1
			i += 1
		if templ != -1 and tempr != -1:
			L = max(L, templ)
			R = max(R, tempr)
		if L == -1 and R == -1:
			return [-1]
		else:
			return [L + 1, R + 1]


class Solution:

	def findRange(self, arr, size):
		l = -1
		r = -1
		sm = 0
		mx = 0
		(al, ar) = (-1, -1)
		flag = 1
		for i in range(size):
			if arr[i] == '1':
				sm -= 1
				if sm < 0:
					sm = 0
					flag = 1
			elif arr[i] == '0':
				sm += 1
				if flag:
					l = i + 1
					flag = 0
				if sm > mx:
					mx = sm
					r = i + 1
					al = l
					ar = r
		if al == -1:
			return [-1]
		else:
			return [al, ar]


class Solution:

	def findRange(self, a, size):
		count = 0
		l = -1
		max = 0
		ansL = -1
		ansR = -1
		for i in range(size):
			if a[i] == '0':
				count += 1
			else:
				count -= 1
				if count < 0:
					l = -1
					count = 0
			if count == 1 and l == -1:
				l = i
			if count > max:
				max = count
				ansL = l
				ansR = i
			ans = []
			if ansL == -1:
				ans.append(-1)
			else:
				ans.append(ansL + 1)
				ans.append(ansR + 1)
		return ans


class Solution:

	def findRange(self, arr, size):
		one = 0
		zro = 0
		for i in range(size):
			if arr[i]:
				one += 1
			else:
				zro += 1
		st = []
		l = -1
		r = -1
		(viszr, visone) = (0, 0)
		sm = 0
		mx = 0
		(al, ar) = (-1, -1)
		flag = 1
		for i in range(size):
			if arr[i] == '1' and viszr != 0:
				sm -= 1
				if sm < 0:
					sm = 0
					flag = 1
			elif arr[i] == '0':
				sm += 1
				if flag:
					l = i + 1
					flag = 0
				viszr += 1
				if sm > mx:
					mx = sm
					r = i + 1
					al = l
					ar = r
		if al == -1:
			return [-1]
		else:
			return [al, ar]


class Solution:

	def findRange(self, a, size):
		total = 0
		currCnt = 0
		l = 0
		res = [-1]
		for (r, c) in enumerate(a):
			if c == '1':
				currCnt -= 1
			if c == '0':
				currCnt += 1
			if currCnt > total:
				total = currCnt
				res = [l + 1, r + 1]
			if currCnt < 0:
				currCnt = 0
				l = r + 1
		return res


class Solution:

	def findRange(self, a, size):
		cur = 0
		mx = 0
		l = 0
		ans = [-1]
		for (r, val) in enumerate(a):
			if val == '1':
				cur -= 1
			else:
				cur += 1
			if cur > mx:
				mx = cur
				ans = [l + 1, r + 1]
			if cur < 0:
				cur = 0
				l = r + 1
		return ans


class Solution:

	def findRange(self, a, size):
		dp = [-1] * size
		dp[0] = 1 if a[0] == '0' else -1
		for i in range(1, size, 1):
			if a[i] == '0':
				dp[i] = max(dp[i - 1] + 1, 1)
			else:
				dp[i] = max(dp[i - 1] - 1, -1)
		(start, end) = (0, -1)
		mx = 0
		s = -1
		for i in range(n):
			if dp[i] == -1:
				start = i + 1
			if mx < dp[i]:
				s = start
				mx = dp[i]
				end = i
		if s == -1 and end == -1:
			return [-1]
		return [s + 1, end + 1]