Given a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both voodoo and melee are unbalanced, while neither noon nor a is.
You are given a string s consisting of lowercase letters. Determine if there exists a (contiguous) substring of s that is unbalanced. If the answer is positive, show a position where such a substring occurs in s.

-----Constraints-----
 - 2 ≦ |s| ≦ 10^5
 - s consists of lowercase letters.

-----Partial Score-----
 - 200 points will be awarded for passing the test set satisfying 2 ≦ N ≦ 100.

-----Input-----
The input is given from Standard Input in the following format:
s

-----Output-----
If there exists no unbalanced substring of s, print -1 -1.
If there exists an unbalanced substring of s, let one such substring be s_a s_{a+1} ... s_{b} (1 ≦ a < b ≦ |s|), and print a b. If there exists more than one such substring, any of them will be accepted.

-----Sample Input-----
needed

-----Sample Output-----
2 5

The string s_2 s_3 s_4 s_5 = eede is unbalanced. There are also other unbalanced substrings. For example, the output 2 6 will also be accepted.

Difficulty: MEDIUM_HARD

Starter code:

Solutions:
import sys
s = input()
l = len(s)
if l == 2:
	if s[0] == s[1]:
		print(1, 2)
		return
	else:
		print('-1 -1')
		return
for i in range(l - 2):
	s1 = s[i]
	s2 = s[i + 1]
	s3 = s[i + 2]
	if s1 == s2 or s1 == s3 or s2 == s3:
		print(i + 1, i + 3)
		return
print('-1 -1')


s = str(input())
(a, b) = (0, 0)
for i in range(len(s) - 1):
	if s[i] == s[i + 1]:
		(a, b) = (i + 1, i + 2)
		break
	elif i < len(s) - 2:
		if s[i] == s[i + 2]:
			(a, b) = (i + 1, i + 3)
			break
if a == 0:
	print(-1, -1)
else:
	print(a, b)


s = input()
n = len(s)
for i in range(n - 1):
	if s[i] == s[i + 1]:
		print((i + 1, i + 2))
		return
for i in range(n - 2):
	if s[i] == s[i + 2]:
		print((i + 1, i + 3))
		return
print((-1, -1))


import sys
import re

def std_in():
	return sys.stdin.readline().strip()

def first_match_of_pattern(text, pattern):
	if type(text) != str:
		text = str(text)
	re_patter = re.compile(pattern)
	ans = re_patter.findall(text)
	if ans:
		return ans[0]
	return ''

def _main():
	s = std_in()
	az = [chr(i) for i in range(97, 97 + 26)]
	for c in az:
		p = '[' + c + '][a-z][' + c + ']'
		mt = first_match_of_pattern(s, p)
		if mt != '':
			first = s.find(mt) + 1
			end = first + len(mt) - 1
			print((first, end))
			break
		p = '[' + c + '][' + c + ']'
		mt = first_match_of_pattern(s, p)
		if mt != '':
			first = s.find(mt) + 1
			end = first + len(mt) - 1
			print((first, end))
			break
	else:
		print((-1, -1))

def __starting_point():
	_main()
__starting_point()


from collections import Counter
s = input()
n = len(s)
for i in range(n):
	if n == 2:
		if s[0] == s[1]:
			print(1, 2)
			return
	if i == n - 2:
		break
	c = Counter(s[i:i + 3])
	v = c.most_common()
	if v[0][1] * 2 > len(s[i:i + 3]):
		print(i + 1, i + 3)
		return
print(-1, -1)


import sys
import numpy as np
from heapq import heappush, heappop
from bisect import bisect_left as bi_l, bisect_right as bi_r
from collections import deque, Counter, defaultdict
from itertools import combinations, product
import string
inf = float('inf')
MOD = 10 ** 9 + 7

class NumberTheory:

	def __init__(self, n=2 * 10 ** 6, numpy=True):
		self.n = n
		self.np_flg = numpy
		(self.is_prime_number, self.prime_numbers) = self.sieve_of_eratosthenes(n)

	def sieve_of_eratosthenes(self, n):
		if self.np_flg:
			sieve = np.ones(n + 1, dtype=np.int64)
			sieve[:2] = 0
			for i in range(2, int(n ** 0.5) + 1):
				if sieve[i]:
					sieve[i * 2::i] = 0
			prime_numbers = np.flatnonzero(sieve)
		else:
			sieve = [1] * (n + 1)
			sieve[0] = sieve[1] = 0
			for i in range(2, int(n ** 0.5) + 1):
				if not sieve[i]:
					continue
				for j in range(i * 2, n + 1, i):
					sieve[j] = 0
			prime_numbers = [i for i in range(2, n + 1) if sieve[i]]
		return (sieve, prime_numbers)

	def prime_factorize(self, n):
		res = dict()
		if n < 2:
			return res
		border = int(n ** 0.5)
		for p in self.prime_numbers:
			if p > border:
				break
			while n % p == 0:
				res[p] = res.get(p, 0) + 1
				n //= p
			if n == 1:
				return res
		res[n] = 1
		return res

	def prime_factorize_factorial(self, n):
		res = dict()
		for i in range(2, n + 1):
			for (p, c) in self.prime_factorize(i).items():
				res[p] = res.get(p, 0) + c
		return res

	@staticmethod
	def gcd(a, b):
		return gcd(b, a % b) if b else abs(a)

	@staticmethod
	def lcm(a, b):
		return abs(a // gcd(a, b) * b)

	@staticmethod
	def find_divisors(n):
		divisors = []
		for i in range(1, int(n ** 0.5) + 1):
			if n % i:
				continue
			divisors.append(i)
			j = n // i
			if j != i:
				divisors.append(j)
		return divisors

	@staticmethod
	def base_convert(n, b):
		if not n:
			return [0]
		res = []
		while n:
			(n, r) = divmod(n, b)
			if r < 0:
				n += 1
				r -= b
			res.append(r)
		return res

class UnionFind:

	def __init__(self, n=10 ** 6):
		self.root = list(range(n))
		self.height = [0] * n
		self.size = [1] * n

	def find_root(self, u):
		if self.root[u] == u:
			return u
		self.root[u] = self.find_root(self.root[u])
		return self.root[u]

	def unite(self, u, v):
		ru = self.find_root(u)
		rv = self.find_root(v)
		if ru == rv:
			return
		hu = self.height[ru]
		hv = self.height[rv]
		if hu >= hv:
			self.root[rv] = ru
			self.size[ru] += self.size[rv]
			self.height[ru] = max(hu, hv + 1)
		else:
			self.root[ru] = rv
			self.size[rv] += self.size[ru]

class Combinatorics:

	def __init__(self, N=10 ** 9, n=10 ** 6, mod=10 ** 9 + 7, numpy=True):
		self.mod = mod
		self.nCr = dict()
		self.np_flg = numpy
		self.make_mod_tables(N, n)
	sys.setrecursionlimit(10 ** 6)

	def choose(self, n, r, mod=None):
		if r > n or r < 0:
			return 0
		if r == 0:
			return 1
		if (n, r) in self.nCr:
			return self.nCr[n, r]
		if not mod:
			self.nCr[n, r] = self.choose(n - 1, r) + self.choose(n - 1, r - 1)
		else:
			self.nCr[n, r] = (self.choose(n - 1, r, mod) + self.choose(n - 1, r - 1, mod)) % mod
		return self.nCr[n, r]

	def cumprod(self, a):
		p = self.mod
		l = len(a)
		sql = int(np.sqrt(l) + 1)
		a = np.resize(a, sql ** 2).reshape(sql, sql)
		for i in range(sql - 1):
			a[:, i + 1] *= a[:, i]
			a[:, i + 1] %= p
		for i in range(sql - 1):
			a[i + 1] *= a[i, -1]
			a[i + 1] %= p
		return np.ravel(a)[:l]

	def make_mod_tables(self, N, n):
		p = self.mod
		if self.np_flg:
			fac = np.arange(n + 1)
			fac[0] = 1
			fac = self.cumprod(fac)
			ifac = np.arange(n + 1, 0, -1)
			ifac[0] = pow(int(fac[-1]), p - 2, p)
			ifac = self.cumprod(ifac)[n::-1]
			n_choose = np.arange(N + 1, N - n, -1)
			n_choose[0] = 1
			n_choose[1:] = self.cumprod(n_choose[1:]) * ifac[1:n + 1] % p
		else:
			fac = [None] * (n + 1)
			fac[0] = 1
			for i in range(n):
				fac[i + 1] = fac[i] * (i + 1) % p
			ifac = [None] * (n + 1)
			ifac[n] = pow(fac[n], p - 2, p)
			for i in range(n, 0, -1):
				ifac[i - 1] = ifac[i] * i % p
			n_choose = [None] * (n + 1)
			n_choose[0] = 1
			for i in range(n):
				n_choose[i + 1] = n_choose[i] * (N - i) % p
			for i in range(n + 1):
				n_choose[i] = n_choose[i] * ifac[i] % p
		(self.fac, self.ifac, self.mod_n_choose) = (fac, ifac, n_choose)

	def mod_choose(self, n, r):
		return self.fac[n] * self.ifac[r] % self.mod * self.ifac[n - r] % self.mod

def z_algorithm(s):
	n = len(s)
	a = [0] * n
	a[0] = n
	l = r = -1
	for i in range(1, n):
		if r >= i:
			a[i] = min(a[i - l], r - i)
		while i + a[i] < n and s[i + a[i]] == s[a[i]]:
			a[i] += 1
		if i + a[i] >= r:
			(l, r) = (i, i + a[i])
	return a

class ABC001:

	def A():
		(h1, h2) = map(int, sys.stdin.read().split())
		print(h1 - h2)

	def B():
		pass

	def C():
		pass

	def D():
		pass

class ABC002:

	def A():
		(x, y) = map(int, sys.stdin.readline().split())
		print(max(x, y))

	def B():
		vowels = set('aeiou')
		s = sys.stdin.readline().rstrip()
		t = ''
		for c in s:
			if c in vowels:
				continue
			t += c
		print(t)

	def C():
		(*coords,) = map(int, sys.stdin.readline().split())

		def triangle_area(x0, y0, x1, y1, x2, y2):
			x1 -= x0
			x2 -= x0
			y1 -= y0
			y2 -= y0
			return abs(x1 * y2 - x2 * y1) / 2
		print(triangle_area(*coords))

	def D():
		(n, m) = map(int, sys.stdin.readline().split())
		edges = set()
		for _ in range(m):
			(x, y) = map(int, sys.stdin.readline().split())
			x -= 1
			y -= 1
			edges.add((x, y))
		cand = []
		for i in range(1, 1 << n):
			s = [j for j in range(n) if i >> j & 1]
			for (x, y) in combinations(s, 2):
				if (x, y) not in edges:
					break
			else:
				cand.append(len(s))
		print(max(cand))

class ABC003:

	def A():
		n = int(sys.stdin.readline().rstrip())
		print((n + 1) * 5000)

	def B():
		atcoder = set('atcoder')
		(s, t) = sys.stdin.read().split()
		for i in range(len(s)):
			if s[i] == t[i]:
				continue
			if s[i] == '@' and t[i] in atcoder:
				continue
			if t[i] == '@' and s[i] in atcoder:
				continue
			print('You will lose')
			return
		print('You can win')

	def C():
		(n, k, *r) = map(int, sys.stdin.read().split())
		res = 0
		for x in sorted(r)[-k:]:
			res = (res + x) / 2
		print(res)

	def D():
		pass

class ABC004:

	def A():
		print(int(sys.stdin.readline().rstrip()) * 2)

	def B():
		c = [sys.stdin.readline().rstrip() for _ in range(4)]
		for l in c[::-1]:
			print(l[::-1])

	def C():
		n = int(sys.stdin.readline().rstrip())
		n %= 30
		res = list(range(1, 7))
		for i in range(n):
			i %= 5
			(res[i], res[i + 1]) = (res[i + 1], res[i])
		print(''.join(map(str, res)))

	def D():
		pass

class ABC005:

	def A():
		(x, y) = map(int, sys.stdin.readline().split())
		print(y // x)

	def B():
		(n, *t) = map(int, sys.stdin.read().split())
		print(min(t))

	def C():
		t = int(sys.stdin.readline().rstrip())
		n = int(sys.stdin.readline().rstrip())
		a = [int(x) for x in sys.stdin.readline().split()]
		m = int(sys.stdin.readline().rstrip())
		b = [int(x) for x in sys.stdin.readline().split()]
		i = 0
		for p in b:
			if i == n:
				print('no')
				return
			while p - a[i] > t:
				i += 1
				if i == n:
					print('no')
					return
			if a[i] > p:
				print('no')
				return
			i += 1
		print('yes')

	def D():
		n = int(sys.stdin.readline().rstrip())
		d = np.array([sys.stdin.readline().split() for _ in range(n)], np.int64)
		s = d.cumsum(axis=0).cumsum(axis=1)
		s = np.pad(s, 1)
		max_del = np.zeros((n + 1, n + 1), dtype=np.int64)
		for y in range(1, n + 1):
			for x in range(1, n + 1):
				max_del[y, x] = np.amax(s[y:n + 1, x:n + 1] - s[0:n - y + 1, x:n + 1] - s[y:n + 1, 0:n - x + 1] + s[0:n - y + 1, 0:n - x + 1])
		res = np.arange(n ** 2 + 1)[:, None]
		i = np.arange(1, n + 1)
		res = max_del[i, np.minimum(res // i, n)].max(axis=1)
		q = int(sys.stdin.readline().rstrip())
		p = np.array(sys.stdin.read().split(), dtype=np.int64)
		print(*res[p], sep='\n')

class ABC006:

	def A():
		n = sys.stdin.readline().rstrip()
		if '3' in n:
			print('YES')
		elif int(n) % 3 == 0:
			print('YES')
		else:
			print('NO')

	def B():
		mod = 10007
		t = [0, 0, 1]
		for _ in range(1001001):
			t.append(t[-1] + t[-2] + t[-3])
			t[-1] %= mod
		n = int(sys.stdin.readline().rstrip())
		print(t[n - 1])

	def C():
		(n, m) = map(int, sys.stdin.readline().split())
		cnt = [0, 0, 0]
		if m == 1:
			cnt = [-1, -1, -1]
		else:
			if m & 1:
				m -= 3
				cnt[1] += 1
				n -= 1
			cnt[2] = m // 2 - n
			cnt[0] = n - cnt[2]
		if cnt[0] < 0 or cnt[1] < 0 or cnt[2] < 0:
			print(-1, -1, -1)
		else:
			print(*cnt, sep=' ')

	def D():
		(n, *c) = map(int, sys.stdin.read().split())
		lis = [inf] * n
		for x in c:
			lis[bi_l(lis, x)] = x
		print(n - bi_l(lis, inf))

class ABC007:

	def A():
		n = int(sys.stdin.readline().rstrip())
		print(n - 1)

	def B():
		s = sys.stdin.readline().rstrip()
		if s == 'a':
			print(-1)
		else:
			print('a')

	def C():
		(r, c) = map(int, sys.stdin.readline().split())
		(sy, sx) = map(int, sys.stdin.readline().split())
		(gy, gx) = map(int, sys.stdin.readline().split())
		sy -= 1
		sx -= 1
		gy -= 1
		gx -= 1
		maze = [sys.stdin.readline().rstrip() for _ in range(r)]
		queue = deque([(sy, sx)])
		dist = np.full((r, c), np.inf)
		dist[sy, sx] = 0
		while queue:
			(y, x) = queue.popleft()
			for (i, j) in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
				i += y
				j += x
				if maze[i][j] == '#' or dist[i, j] != np.inf:
					continue
				dist[i, j] = dist[y, x] + 1
				queue.append((i, j))
		print(int(dist[gy, gx]))

	def D():
		pass

class ABC008:

	def A():
		(s, t) = map(int, sys.stdin.readline().split())
		print(t - s + 1)

	def B():
		(n, *s) = sys.stdin.read().split()
		res = defaultdict(int)
		for name in s:
			res[name] += 1
		print(sorted(res.items(), key=lambda x: x[1])[-1][0])

	def C():
		(n, *a) = map(int, sys.stdin.read().split())
		a = np.array(a)
		c = n - np.count_nonzero(a[:, None] % a, axis=1)
		print(np.sum((c + 1) // 2 / c))

	def D():
		pass

class ABC009:

	def A():
		n = int(sys.stdin.readline().rstrip())
		print((n + 1) // 2)

	def B():
		(n, *a) = map(int, sys.stdin.read().split())
		print(sorted(set(a))[-2])

	def C():
		(n, k) = map(int, sys.stdin.readline().split())
		s = list(sys.stdin.readline().rstrip())
		cost = [1] * n
		r = k
		for i in range(n - 1):
			q = []
			for j in range(i + 1, n):
				if s[j] < s[i] and cost[i] + cost[j] <= r:
					heappush(q, (s[j], cost[i] + cost[j], -j))
			if not q:
				continue
			(_, c, j) = heappop(q)
			j = -j
			(s[i], s[j]) = (s[j], s[i])
			r -= c
			cost[i] = cost[j] = 0
		print(''.join(s))

	def D():
		pass

class ABC010:

	def A():
		print(sys.stdin.readline().rstrip() + 'pp')

	def B():
		(n, *a) = map(int, sys.stdin.read().split())
		tot = 0
		for x in a:
			c = 0
			while x % 2 == 0 or x % 3 == 2:
				x -= 1
				c += 1
			tot += c
		print(tot)

	def C():
		(sx, sy, gx, gy, t, v, n, *xy) = map(int, sys.stdin.read().split())
		(x, y) = np.array(xy).reshape(-1, 2).T

		def dist(x1, y1, x2, y2):
			return np.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
		ans = 'YES' if (dist(sx, sy, x, y) + dist(x, y, gx, gy) <= v * t).any() else 'NO'
		print(ans)

	def D():
		pass

class ABC011:

	def A():
		n = int(sys.stdin.readline().rstrip())
		print(n % 12 + 1)

	def B():
		s = sys.stdin.readline().rstrip()
		print(s[0].upper() + s[1:].lower())

	def C():
		(n, *ng) = map(int, sys.stdin.read().split())
		ng = set(ng)
		if n in ng:
			print('NO')
		else:
			r = 100
			while n > 0:
				if r == 0:
					print('NO')
					return
				for i in range(3, 0, -1):
					if n - i in ng:
						continue
					n -= i
					r -= 1
					break
				else:
					print('NO')
					return
			print('YES')

	def D():
		pass

class ABC041:

	def A():
		(s, i) = sys.stdin.read().split()
		i = int(i)
		print(s[i - 1])

	def B():
		(a, b, c) = map(int, sys.stdin.readline().split())
		ans = a * b % MOD * c % MOD
		print(ans)

	def C():
		(n, *a) = map(int, sys.stdin.read().split())
		for (i, h) in sorted(enumerate(a), key=lambda x: -x[1]):
			print(i + 1)

	def D():
		(n, m, *xy) = map(int, sys.stdin.read().split())
		(*xy,) = zip(*[iter(xy)] * 2)
		edges = [0] * n
		for (x, y) in xy:
			x -= 1
			y -= 1
			edges[x] |= 1 << y
		comb = [None] * (1 << n)
		comb[0] = 1

		def count(edges, bit):
			if comb[bit] is not None:
				return comb[bit]
			comb[bit] = 0
			for i in range(n):
				if bit >> i & 1 and (not edges[i]):
					nxt_bit = bit & ~(1 << i)
					nxt_edges = edges.copy()
					for j in range(n):
						nxt_edges[j] &= ~(1 << i)
					cnt = count(nxt_edges, nxt_bit)
					comb[bit] += cnt
			return comb[bit]
		print(count(edges, (1 << n) - 1))

class ABC042:

	def A():
		a = [int(x) for x in sys.stdin.readline().split()]
		c = Counter(a)
		print('YES' if c[5] == 2 and c[7] == 1 else 'NO')

	def B():
		(n, l, *s) = sys.stdin.read().split()
		print(''.join(sorted(s)))

	def C():
		(n, k, *d) = sys.stdin.read().split()
		l = len(n)
		ok = sorted(set(string.digits) - set(d))
		cand = [int(''.join(p)) for p in product(ok, repeat=l)] + [int(min((x for x in ok if x > '0')) + min(ok) * l)]
		print(cand[bi_l(cand, int(n))])

	def D():
		(h, w, a, b) = map(int, sys.stdin.read().split())
		combinatorics = Combinatorics(n=2 * 10 ** 5, mod=MOD, numpy=True)
		tot = combinatorics.mod_choose(h + w - 2, h - 1)
		i = np.arange(h - a, h)
		ng = np.sum(combinatorics.mod_choose(i + b - 1, i) * combinatorics.mod_choose(h - i + w - b - 2, h - 1 - i) % MOD)
		tot -= ng
		tot %= MOD
		print(tot)

class ABC043:

	def A():
		n = int(sys.stdin.readline().rstrip())
		print((1 + n) * n // 2)

	def B():
		s = sys.stdin.readline().rstrip()
		t = ''
		for c in s:
			if c == 'B':
				t = t[:-1]
			else:
				t += c
		print(t)

	def C():
		(n, *a) = map(int, sys.stdin.read().split())
		a = np.array(a)
		x = np.around(a.sum() / n).astype(int)
		print(np.sum((a - x) ** 2))

	def D():
		s = sys.stdin.readline().rstrip()
		n = len(s)
		for i in range(n - 1):
			if s[i] == s[i + 1]:
				print(i + 1, i + 2)
				return
		for i in range(n - 2):
			if s[i] == s[i + 2]:
				print(i + 1, i + 3)
				return
		print(-1, -1)

class ABC170:

	def A():
		x = [int(x) for x in sys.stdin.readline().split()]
		for i in range(5):
			if x[i] != i + 1:
				print(i + 1)
				break

	def B():
		(x, y) = map(int, sys.stdin.readline().split())
		print('Yes' if 2 * x <= y <= 4 * x and y % 2 == 0 else 'No')

	def C():
		(x, n, *p) = map(int, sys.stdin.read().split())
		a = list(set(range(102)) - set(p))
		a = [(abs(y - x), y) for y in a]
		print(sorted(a)[0][1])

	def D():
		(n, *a) = map(int, sys.stdin.read().split())
		cand = set(a)
		cnt = 0
		for (x, c) in sorted(Counter(a).items()):
			cnt += c == 1 and x in cand
			cand -= set(range(x * 2, 10 ** 6 + 1, x))
		print(cnt)

	def E():
		(n, q) = map(int, sys.stdin.readline().split())
		queue = []
		num_kindergarten = 2 * 10 ** 5
		queue_kindergarten = [[] for _ in range(num_kindergarten)]
		highest_kindergarten = [None] * num_kindergarten
		where = [None] * n
		rate = [None] * n

		def entry(i, k):
			where[i] = k
			while queue_kindergarten[k]:
				(r, j) = heappop(queue_kindergarten[k])
				if where[j] != k or j == i:
					continue
				if rate[i] >= -r:
					highest_kindergarten[k] = rate[i]
					heappush(queue, (rate[i], k, i))
				heappush(queue_kindergarten[k], (r, j))
				break
			else:
				highest_kindergarten[k] = rate[i]
				heappush(queue, (rate[i], k, i))
			heappush(queue_kindergarten[k], (-rate[i], i))

		def transfer(i, k):
			now = where[i]
			while queue_kindergarten[now]:
				(r, j) = heappop(queue_kindergarten[now])
				if where[j] != now or j == i:
					continue
				if highest_kindergarten[now] != -r:
					highest_kindergarten[now] = -r
					heappush(queue, (-r, now, j))
				heappush(queue_kindergarten[now], (r, j))
				break
			else:
				highest_kindergarten[now] = None
			entry(i, k)

		def inquire():
			while True:
				(r, k, i) = heappop(queue)
				if where[i] != k or r != highest_kindergarten[k]:
					continue
				heappush(queue, (r, k, i))
				return r
		for i in range(n):
			(a, b) = map(int, sys.stdin.readline().split())
			rate[i] = a
			entry(i, b - 1)
		for _ in range(q):
			(c, d) = map(int, sys.stdin.readline().split())
			transfer(c - 1, d - 1)
			print(inquire())

	def F():
		pass

class ABC171:

	def A():
		c = sys.stdin.readline().rstrip()
		print('A' if c < 'a' else 'a')

	def B():
		(n, k, *p) = map(int, sys.stdin.read().split())
		print(sum(sorted(p)[:k]))

	def C():
		n = int(sys.stdin.readline().rstrip())
		n -= 1
		l = 1
		while True:
			if n < pow(26, l):
				break
			n -= pow(26, l)
			l += 1
		res = ''.join([chr(ord('a') + d) for d in NumberTheory.base_convert(n, 26)][::-1])
		res = 'a' * (l - len(res)) + res
		print(res)

	def D():
		n = int(sys.stdin.readline().rstrip())
		a = [int(x) for x in sys.stdin.readline().split()]
		s = sum(a)
		cnt = Counter(a)
		q = int(sys.stdin.readline().rstrip())
		for _ in range(q):
			(b, c) = map(int, sys.stdin.readline().split())
			s += (c - b) * cnt[b]
			print(s)
			cnt[c] += cnt[b]
			cnt[b] = 0

	def E():
		(n, *a) = map(int, sys.stdin.read().split())
		s = 0
		for x in a:
			s ^= x
		b = map(lambda x: x ^ s, a)
		print(*b, sep=' ')

	def F():
		pass

class ABC172:

	def A():
		pass

	def B():
		pass

	def C():
		pass

	def D():
		pass

	def E():
		pass

	def F():
		pass

class ABC173:

	def A():
		n = int(sys.stdin.readline().rstrip())
		charge = (n + 999) // 1000 * 1000 - n
		print(charge)

	def B():
		(n, *s) = sys.stdin.read().split()
		c = Counter(s)
		for v in 'AC, WA, TLE, RE'.split(', '):
			print(f'{v} x {c[v]}')

	def C():
		(h, w, k) = map(int, sys.stdin.readline().split())
		c = [sys.stdin.readline().rstrip() for _ in range(h)]
		tot = 0
		for i in range(1 << h):
			for j in range(1 << w):
				cnt = 0
				for y in range(h):
					for x in range(w):
						if i >> y & 1 or j >> x & 1:
							continue
						cnt += c[y][x] == '#'
				tot += cnt == k
		print(tot)

	def D():
		(n, *a) = map(int, sys.stdin.read().split())
		a.sort(reverse=True)
		res = a[0] + sum(a[1:1 + (n - 2) // 2]) * 2 + a[1 + (n - 2) // 2] * (n & 1)
		print(res)

	def E():
		MOD = 10 ** 9 + 7
		(n, k, *a) = map(int, sys.stdin.read().split())
		minus = [x for x in a if x < 0]
		plus = [x for x in a if x > 0]
		if len(plus) + len(minus) // 2 * 2 >= k:
			(*minus,) = map(abs, minus)
			minus.sort(reverse=True)
			plus.sort(reverse=True)
			cand = []
			if len(minus) & 1:
				minus = minus[:-1]
			for i in range(0, len(minus) - 1, 2):
				cand.append(minus[i] * minus[i + 1] % MOD)
			if k & 1:
				res = plus[0]
				plus = plus[1:]
			else:
				res = 1
			if len(plus) & 1:
				plus = plus[:-1]
			for i in range(0, len(plus) - 1, 2):
				cand.append(plus[i] * plus[i + 1] % MOD)
			cand.sort(reverse=True)
			for x in cand[:k // 2]:
				res *= x
				res %= MOD
			print(res)
		elif 0 in a:
			print(0)
		else:
			cand = sorted(map(abs, a))
			res = 1
			for i in range(k):
				res *= cand[i]
				res %= MOD
			res = MOD - res
			print(res)
			pass

	def F():
		pass

def __starting_point():
	ABC043.D()
__starting_point()


S = input()
for i in range(26):
	c = chr(i + 97)
	prev = -3
	for j in range(len(S)):
		if S[j] == c:
			if j - prev <= 2:
				print(prev + 1, j + 1)
				break
			prev = j
	else:
		continue
	break
else:
	print(-1, -1)


S = input()
N = len(S)
if N == 2 and S[0] == S[1]:
	print(1, 2)
	return
for i in range(N - 2):
	if len(set(S[i:i + 3])) <= 2:
		print(i + 1, i + 3)
		return
print(-1, -1)


S = input()
N = len(S)
for i in range(N - 1):
	if S[i] == S[i + 1]:
		print(i + 1, i + 2)
		return
	if i != N - 2:
		if S[i] == S[i + 2]:
			print(i + 1, i + 3)
			return
print(-1, -1)


s = input()
for i in range(len(s) - 1):
	if s[i:i + 3].count(s[i]) >= 2:
		print('{} {}'.format(i + 1, min(len(s), i + 3)))
		break
else:
	print('-1 -1')


s = input()
if len(s) != 2:
	for i in range(len(s) - 2):
		if s[i] == s[i + 1] or s[i + 1] == s[i + 2] or s[i] == s[i + 2]:
			print(i + 1, i + 3)
			return
elif s[0] == s[1]:
	print(1, 2)
	return
print(-1, -1)


S = input()
N = len(S)
S = '!' + S + '!'
if N == 2:
	if S[1] == S[2]:
		print('1 2')
	else:
		print('-1 -1')
	return
for i in range(1, N + 1, 1):
	PrevAl = S[i - 1]
	NowAl = S[i]
	NextAl = S[i + 1]
	if PrevAl == NowAl or NowAl == NextAl or PrevAl == NextAl:
		AnsL = i - 1
		AnsR = i + 1
		if AnsL == 0:
			AnsL = 1
		print((AnsL, AnsR))
		return
print('-1 -1')


import os, sys, re, math, queue
S = input()
al = 'abcdefghijklmnopqrstuvwxyz'

def doit():
	for a in al:
		m = re.search(a + '{2,}', S)
		if m:
			return str(m.start() + 1) + ' ' + str(m.end())
		m = re.search(a + '[^' + a + ']' + a, S)
		if m:
			return str(m.start() + 1) + ' ' + str(m.end())
	return '-1 -1'
print(doit())


ma = lambda : map(int, input().split())
lma = lambda : list(map(int, input().split()))
tma = lambda : tuple(map(int, input().split()))
ni = lambda : int(input())
yn = lambda fl: print('Yes') if fl else print('No')
import collections
import math
import itertools
import heapq as hq
s = input()
idxs = [[] for i in range(26)]

def wid(w):
	return ord(w) - ord('a')
for i in range(len(s)):
	w = s[i]
	idxs[wid(w)].append(i)
a = -1
b = -1
for i in range(26):
	if len(idxs[i]) >= 2:
		prev = idxs[i][0]
		for nex in idxs[i]:
			d = nex - prev
			if 1 <= d <= 2:
				a = prev + 1
				b = nex + 1
				break
			prev = nex
print(a, b)


import sys
import collections
input = sys.stdin.readline

def main():
	S = input().strip()
	a = [[] for _ in range(26)]
	for (i, s) in enumerate(S):
		a[ord(s) - ord('a')].append(i)
	ans = []
	f = False
	for i in range(26):
		for j in range(len(a[i]) - 1):
			if a[i][j + 1] - a[i][j] + 1 < 4:
				ans.append(a[i][j])
				ans.append(a[i][j + 1])
				f = True
				break
		if f:
			break
	if f:
		print((ans[0] + 1, ans[1] + 1))
	else:
		print((-1, -1))

def __starting_point():
	main()
__starting_point()


s = input() + '_'
x = y = -2
for i in range(len(s) - 2):
	if s[i] == s[i + 1]:
		x = i
		y = i + 1
	if s[i] == s[i + 2]:
		x = i
		y = i + 2
print(x + 1, y + 1)


s = input()
n = len(s)
s = s + '0'
(ans1, ans2) = (-1, -1)
for i in range(n - 1):
	if s[i] == s[i + 1]:
		(ans1, ans2) = (i + 1, i + 2)
		break
	if s[i] == s[i + 2]:
		(ans1, ans2) = (i + 1, i + 3)
		break
print(ans1, ans2)


import io
import sys
import math
CASES = 'abcdefghijklmnopqrstuvwxyz'

def format_multi_line_answer(lst):
	ans = ''
	ans += f'{len(lst)}\n'
	for y in lst:
		ans += f'{y}\n'
	return ans

def is_unballance(s):
	if len(s) == 2 and s[0] == s[1]:
		return True
	if len(s) == 3 and s[0] == s[2]:
		return True
	return False

def solve(s):
	ans_l = []
	has_unbalance = False
	(a, b) = (-1, -1)
	for c in CASES:
		i = s.find(c)
		ii = s.find(c, i + 1)
		while ii != -1:
			if ii - i < 3 and is_unballance(s[i:ii + 1]):
				(a, b) = (i + 1, ii + 1)
				has_unbalance = True
				break
			i = ii
			ii = s.find(c, i + 1)
		if has_unbalance:
			break
	return f'{a} {b}'

def main():
	s = input()
	ans = str(solve(s))
	print(ans)
	return ans
_DEB = 0
_INPUT = 'abcaxa\n'
_EXPECTED = '2 5\n'

def logd(str):
	if _DEB:
		print(f'[deb] {str}')

def __starting_point():
	if _DEB:
		sys.stdin = io.StringIO(_INPUT)
		print('!! Debug Mode !!')
	ans = main()
	if _DEB:
		print()
		if _EXPECTED.strip() == ans.strip():
			print('!! Success !!')
		else:
			print(f'!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}')
__starting_point()


s = input()
x = len(s)
for i in range(x - 2):
	n = s[i:i + 3]
	m = list(set(n))
	if len(m) == 2:
		print(i + 1, i + 3)
		return
if x == 2:
	if s[0] == s[1]:
		print(1, 2)
		return
print(-1, -1)


s = str(input())
flag = 0
for i in range(len(s) - 1):
	if s[i] == s[i + 1]:
		print(str(i + 1) + ' ' + str(i + 2))
		flag = 1
		break
if flag == 0:
	for i in range(len(s) - 2):
		if s[i] == s[i + 2]:
			print(str(i + 1) + ' ' + str(i + 3))
			flag = 1
			break
if flag == 0:
	print('-1 -1')


s = input()
n = len(s)
accum = [[0] * (n + 1) for _ in range(26)]
for i in range(n):
	accum[ord(s[i]) - ord('a')][i + 1] += 1
for i in range(n):
	for j in range(26):
		accum[j][i + 1] += accum[j][i]
for i in range(n - 1):
	for j in range(26):
		if accum[j][i + 2] - accum[j][i] == 2:
			print(i + 1, i + 2)
			return
for i in range(n - 2):
	for j in range(26):
		if accum[j][i + 3] - accum[j][i] == 2:
			print(i + 1, i + 3)
			return
print(-1, -1)


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	S = readline().strip()
	N = len(S)
	(a, b) = (-1, -1)
	for i in range(N):
		if i < N - 1 and S[i] == S[i + 1]:
			(a, b) = (i + 1, i + 2)
			break
		elif i < N - 2 and S[i] == S[i + 2]:
			(a, b) = (i + 1, i + 3)
			break
	print((a, b))
	return

def __starting_point():
	main()
__starting_point()


def abc043_d():
	s = str(input())
	n = len(s)
	ans = (-1, -1)
	if n == 2:
		if s[0] == s[1]:
			ans = (1, 2)
	else:
		for i in range(n - 2):
			if len(set(s[i:i + 3])) < 3:
				ans = (i + 1, i + 3)
				break
	print(*ans, sep=' ')

def __starting_point():
	abc043_d()
__starting_point()


a = input()
t = -1
flag = 'False'
for i in range(len(a) - 1):
	if a[i] == a[i + 1]:
		flag = 'True1'
		t = i
		break
	if i != len(a) - 2:
		if a[i] == a[i + 2]:
			flag = 'True2'
			t = i
			break
if flag == 'False':
	print('{} {}'.format(-1, -1))
elif flag == 'True1':
	print('{} {}'.format(t + 1, t + 2))
else:
	print('{} {}'.format(t + 1, t + 3))


import re

def get_char_list():
	return [chr(ord('a') + i) for i in range(26)]

def main():
	S = input()
	N = len(S)
	char_list = get_char_list()
	for c in char_list:
		for pattern in ['{}.{}'.format(c, c), '{}{}'.format(c, c)]:
			m = re.search(pattern, S)
			if m is not None:
				sp = m.span()
				print('{} {}'.format(sp[0] + 1, sp[1]))
				return
	print('{} {}'.format(-1, -1))

def __starting_point():
	main()
__starting_point()


s = input()
l = len(s)
s += '!' * 10
for i in range(l):
	tar = s[i]
	for j in range(i + 1, i + 3):
		if s[i] == s[j]:
			print(i + 1, j + 1)
			return
print(-1, -1)


s = list(input())
for i in range(len(s) - 1):
	if s[i] == s[i + 1]:
		print('{} {}'.format(i + 1, i + 2))
		break
	if i + 2 != len(s):
		if s[i] == s[i + 2]:
			print('{} {}'.format(i + 1, i + 3))
			break
else:
	print('-1 -1')


s = input()
size = len(s)
if size == 2:
	if s[0] == s[1]:
		print('1 2')
	else:
		print('-1 -1')
else:
	for i in range(2, size):
		a = s[i]
		b = s[i - 1]
		c = s[i - 2]
		if a == b or b == c or a == c:
			print(i - 1, i + 1)
			break
	else:
		print('-1 -1')


import sys
s = input()
for (i, (x, y)) in enumerate(zip(s, s[1:])):
	if x == y:
		print(i + 1, i + 2)
		return
if len(s) <= 2:
	print(-1, -1)
	return
for (i, (x, y, z)) in enumerate(zip(s, s[1:], s[2:])):
	if x == z:
		print(i + 1, i + 3)
		return
print(-1, -1)


s = input()
l = len(s)
for i in range(1, l):
	if s[i] == s[i - 1]:
		print(i, i + 1)
		break
else:
	for i in range(2, l):
		if s[i] == s[i - 2]:
			print(i - 1, i + 1)
			break
	else:
		print(-1, -1)


def main():
	s = input()
	if len(s) == 2:
		if s[0] == s[1]:
			print((1, 2))
		else:
			print((-1, -1))
		return
	for i in range(len(s) - 2):
		if len(set(list(s[i:i + 3]))) < 3:
			print((i + 1, i + 3))
			return
	print((-1, -1))

def __starting_point():
	main()
__starting_point()


import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 13

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def I():
	return int(sys.stdin.buffer.readline())

def LS():
	return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

def S():
	return sys.stdin.buffer.readline().rstrip().decode('utf-8')

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]

def SRL(n):
	return [list(S()) for i in range(n)]

def MSRL(n):
	return [[int(j) for j in list(S())] for i in range(n)]

def SERIES(n):
	return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')

def GRID(h, w):
	return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h, -1)[:, :w]

def GRIDfromString(h, w):
	return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h, -1)[:, :w]
MOD = 1000000007

def main():
	s_list = list(S())
	for t in range(2, min(len(s_list) + 1, 4)):
		for i in range(len(s_list) - t + 1):
			c = Counter(s_list[i:i + t])
			if c.most_common()[0][1] / t > 0.5:
				print(i + 1, i + t)
				break
		else:
			continue
		break
	else:
		print(-1, -1)

def __starting_point():
	main()
__starting_point()


import sys
s = input()
if len(s) == 2 and s[0] == s[1]:
	print('1 2')
	return
else:
	for i in range(0, len(s) - 2):
		(c1, c2, c3) = (s[i], s[i + 1], s[i + 2])
		if len(set([c1, c2, c3])) <= 2:
			print('%s %s' % (i + 1, i + 3))
			return
print('-1 -1')


s = input()
answer = '-1 -1'
if s[-2] == s[-1]:
	answer = '{} {}'.format(len(s) - 1, len(s))
for i in range(len(s) - 2):
	if s[i] == s[i + 1] or s[i] == s[i + 2] or s[i + 1] == s[i + 2]:
		answer = '{} {}'.format(i + 1, i + 3)
		break
print(answer)


arr = input()
chars = dict()
for i in range(len(arr)):
	chars.setdefault(arr[i], [])
	chars[arr[i]].append(i)
for (_, inds) in list(chars.items()):
	for i in range(len(inds) - 1):
		if inds[i + 1] - inds[i] < 3:
			print((inds[i] + 1, inds[i + 1] + 1))
			return
print((-1, -1))


import sys
s = list(input())
for i in range(1, len(s)):
	if s[i - 1] == s[i]:
		print(i, i + 1)
		return
for i in range(2, len(s)):
	if s[i - 2] == s[i]:
		print(i - 1, i + 1)
		return
print(-1, -1)


from collections import Counter

def unbalanced(s):
	c = Counter(s)
	if max(c.values()) > len(s) / 2:
		return True
	else:
		return False
s = input()
l = len(s)
balanced = False
for i in range(l - 1):
	if unbalanced(s[i:i + 2]):
		print(i + 1, i + 2)
		return
for i in range(l - 2):
	if unbalanced(s[i:i + 3]):
		print(i + 1, i + 3)
		return
print(-1, -1)


import io
import sys
import math

def solve(s):
	len_s = len(s)
	(a, b) = (-1, -1)
	for i in range(len_s):
		if len_s - i > 1 and s[i] == s[i + 1]:
			(a, b) = (i + 1, i + 2)
			break
		if len_s - i > 2 and s[i] == s[i + 2]:
			(a, b) = (i + 1, i + 3)
			break
	return f'{a} {b}'

def main():
	s = input()
	ans = str(solve(s))
	print(ans)
	return ans
_DEB = 0
_INPUT = 'aba\n'
_EXPECTED = '2 5\n'

def logd(str):
	if _DEB:
		print(f'[deb] {str}')

def __starting_point():
	if _DEB:
		sys.stdin = io.StringIO(_INPUT)
		print('!! Debug Mode !!')
	ans = main()
	if _DEB:
		print()
		if _EXPECTED.strip() == ans.strip():
			print('!! Success !!')
		else:
			print(f'!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}')
__starting_point()


s = list(input())
for i in range(len(s) - 1):
	v = s[i]
	if s[i + 1] == v:
		print((i + 1, i + 2))
		return
	if i + 2 < len(s) and s[i + 2] == v:
		print((i + 1, i + 3))
		return
print((-1, -1))


s = input()
l = len(s)
for i in range(l - 1):
	if s[i] == s[i + 1]:
		print(i + 1, i + 2)
		break
	elif i == l - 2:
		continue
	elif s[i] == s[i + 2]:
		print(i + 1, i + 3)
		break
else:
	print(-1, -1)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil, pi, factorial
from operator import itemgetter

def I():
	return int(input())

def MI():
	return list(map(int, input().split()))

def LI():
	return list(map(int, input().split()))

def LI2():
	return [int(input()) for i in range(n)]

def MXI():
	return [[LI()] for i in range(n)]

def SI():
	return input().rstrip()

def printns(x):
	print('\n'.join(x))

def printni(x):
	print('\n'.join(list(map(str, x))))
inf = 10 ** 17
mod = 10 ** 9 + 7
s = SI()
n = len(s)
for i in range(n - 1):
	if s[i] == s[i + 1]:
		print((i + 1, i + 2))
		return
for i in range(n - 2):
	if s[i] == s[i + 2]:
		print((i + 1, i + 3))
		return
print((-1, -1))


S = input()
from collections import defaultdict

def unbalance(S):
	D = defaultdict(lambda : 0)
	for s in S:
		D[s] += 1
	if max(D.values()) > len(S) // 2:
		return True
	else:
		return False
lenS = len(S)
for i in range(lenS - 1):
	if unbalance(S[i:i + 2]):
		print(f'{i + 1} {i + 2}')
		break
	if i < lenS - 2 and unbalance(S[i:i + 3]):
		print(f'{i + 1} {i + 3}')
		break
else:
	print('-1 -1')


s = input()
for i in range(len(s) - 1):
	if s[i] == s[i + 1]:
		print(i + 1, i + 2)
		break
	if i + 2 <= len(s) - 1 and (s[i] == s[i + 2] or s[i + 1] == s[i + 2]):
		print(i + 1, i + 3)
		break
else:
	print('-1 -1')


s = input()
d = dict()
ans = '-1 -1'
for i in range(len(s)):
	if d.get(s[i]) is None:
		d[s[i]] = i
	elif i - d[s[i]] <= 2:
		ans = '{a} {b}'.format(b=i + 1, a=d[s[i]] + 1)
		break
	else:
		d[s[i]] = i
print(ans)


import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return list(map(int, input().split()))

def LIST():
	return list(map(int, input().split()))

def ZIP(n):
	return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
from decimal import *
s = input()
for i in range(len(s)):
	if i < len(s) - 1 and s[i] == s[i + 1]:
		print((i + 1, i + 2))
		break
	elif i < len(s) - 2 and s[i] == s[i + 2]:
		print((i + 1, i + 3))
		break
else:
	print((-1, -1))


s = input()
N = len(s)
if N == 2:
	if s[0] == s[1]:
		print('1 2')
		return
	else:
		print('-1 -1')
		return
for i in range(N - 2):
	if s[i] == s[i + 1] or s[i] == s[i + 2]:
		print((i + 1, i + 3))
		return
if s[-1] == s[-2]:
	print((N - 2, N))
	return
print('-1 -1')


s = input()
n = len(s)
if n == 2:
	if s[0] == s[1]:
		print(1, 2)
	else:
		print(-1, -1)
	return
for i in range(n - 2):
	t = s[i:i + 3]
	if t[0] == t[1] or t[1] == t[2] or t[0] == t[2]:
		print(i + 1, i + 3)
		return
print(-1, -1)


s = input()
N = len(s)
res = (-1, -1)
for i in range(N - 1):
	tgt = s[i:i + 2]
	if tgt[0] == tgt[1]:
		res = (i + 1, i + 2)
for i in range(N - 2):
	tgt = s[i:i + 3]
	if tgt[0] == tgt[2]:
		res = (i + 1, i + 3)
print(*res)


s = str(input())
N = len(s)
for i in range(N - 1):
	if s[i] == s[i + 1]:
		print(i + 1, i + 2)
		return
for i in range(N - 2):
	if s[i] == s[i + 2]:
		print(i + 1, i + 3)
		return
print(-1, -1)


import re
text = input()
alphabet = list('abcdefghijklmnopqrstuvwxyz')
output = ['-1', '-1']
for i in range(len(alphabet)):
	pattern = alphabet[i] + '.?' + alphabet[i]
	match_object = re.search('%s.?%s' % (alphabet[i], alphabet[i]), text)
	if match_object:
		output[0] = str(match_object.start() + 1)
		output[1] = str(match_object.end())
		break
print(' '.join(output))


s = input()
n = len(s)
for i in range(n):
	if i + 1 < n:
		if s[i] == s[i + 1]:
			print(str(i + 1) + ' ' + str(i + 1 + 1))
			return
	if i + 2 < n:
		if s[i] == s[i + 2]:
			print(str(i + 1) + ' ' + str(i + 2 + 1))
			return
	if i > 0:
		if s[i] == s[i - 1]:
			print(str(i) + ' ' + str(i + 1))
			return
	if i > 1:
		if s[i] == s[i - 2]:
			print(str(i - 1) + ' ' + str(i + 1))
			return
print('-1 -1')
return


s = input()
left = -1
right = -1
for i in range(len(s) - 1):
	if s[i] == s[i + 1]:
		left = i + 1
		right = i + 2
		break
	if not i == len(s) - 2:
		if s[i] == s[i + 2]:
			left = i + 1
			right = i + 3
			break
print(left, right)


s = input()
n = len(s)

def solve():
	for i in range(1, n):
		if s[i - 1] == s[i]:
			print((i, i + 1))
			return
	for i in range(2, n):
		if s[i - 2] == s[i - 1] or s[i - 1] == s[i] or s[i - 2] == s[i]:
			print((i - 1, i + 1))
			return
	print((-1, -1))
if n == 2:
	if s[0] == s[1]:
		print((1, 2))
	else:
		print((-1, -1))
else:
	solve()


import sys

def main():
	mod = 1000000007
	inf = float('inf')
	sys.setrecursionlimit(10 ** 6)

	def input():
		return sys.stdin.readline().rstrip()

	def ii():
		return int(input())

	def mi():
		return list(map(int, input().split()))

	def mi_0():
		return [int(x) - 1 for x in input().split()]

	def lmi():
		return list(map(int, input().split()))

	def lmi_0():
		return list([int(x) - 1 for x in input().split()])

	def li():
		return list(input())

	def calc_consective(s):
		n = len(s)
		for i in range(n - 1):
			if s[i] == s[i + 1]:
				return [i + 1, i + 2]
		return None

	def calc_skip(s):
		n = len(s)
		for i in range(n - 2):
			if s[i] == s[i + 2]:
				return [i + 1, i + 3]
		return None

	def calc_ans(s):
		ans = calc_consective(s)
		if ans:
			return ans
		ans = calc_skip(s)
		if ans:
			return ans
		return (-1, -1)
	s = input()
	res = calc_ans(s)
	print('{} {}'.format(res[0], res[1]))

def __starting_point():
	main()
__starting_point()


s = input()
for i in range(len(s)):
	if s[i] == s[i - 1] and i - 1 >= 0:
		print(i - 1 + 1, i + 1)
		return
	elif i + 1 <= len(s) - 1 and s[i + 1] == s[i]:
		print(i + 1, i + 1 + 1)
		return
	elif i - 1 >= 0 and i + 1 <= len(s) - 1 and (s[i - 1] == s[i + 1]):
		print(i - 1 + 1, i + 1 + 1)
		return
print(-1, -1)


import sys
s = input()
N = len(s)
for i in range(N - 1):
	if s[i] == s[i + 1]:
		print(i + 1, i + 2)
		return
	if i + 2 < N and s[i] == s[i + 2]:
		print(i + 1, i + 3)
		return
print(-1, -1)


s = input()
a = -1
b = -1
for i in range(len(s) - 2):
	if s[i] == s[i + 1]:
		a = i + 1
		b = i + 2
	elif s[i] == s[i + 2]:
		a = i + 1
		b = i + 3
if s[-1] == s[-2]:
	a = len(s) - 1
	b = len(s)
print(a, b)


from sys import stdin
input = stdin.readline

def Judge(N, S):
	for i in range(N - 1):
		if S[i] == S[i + 1]:
			return (i + 1, i + 2)
	for i in range(N - 2):
		if S[i] == S[i + 2]:
			return (i + 1, i + 3)
	else:
		return (-1, -1)
S = list(input().strip())
N = len(S)
(a, b) = Judge(N, S)
print(a, b)


def main():
	s = input()
	if len(s) == 2:
		if s[0] == s[1]:
			print((1, 2))
			return
	for i in range(len(s) - 2):
		if s[i] == s[i + 1]:
			print((i + 1, i + 2))
			break
		elif s[i] == s[i + 2]:
			print((i + 1, i + 3))
			break
	else:
		print((-1, -1))

def __starting_point():
	main()
__starting_point()


s = input()
n = len(s)
for i in range(1, len(s)):
	if s[i - 1] == s[i]:
		print((i, i + 1))
		break
	elif i > 1 and s[i - 2] == s[i]:
		print((i - 1, i + 1))
		break
else:
	print((-1, -1))


s = input()
n = len(s)
a = b = -1
for i in range(n - 1):
	if s[i] == s[i + 1]:
		(a, b) = (i + 1, i + 2)
		break
	elif i + 2 < n and s[i] == s[i + 2]:
		(a, b) = (i + 1, i + 3)
		break
print((a, b))


S = input() + '_'
x = -2
y = -2
for n in range(len(S) - 2):
	if S[n] == S[n + 1]:
		x = n
		y = n + 1
	if S[n] == S[n + 2]:
		x = n
		y = n + 2
print(x + 1, y + 1)


import sys
import string
alphabets = list(string.ascii_lowercase)
s = input()
l = len(s)
hm = lambda a, string: sum([x == a for x in string])
for x in range(l - 1):
	if s[x] == s[x + 1]:
		print('{} {}'.format(x + 1, x + 2))
		return
for n in range(l - 3):
	for a in alphabets:
		if hm(a, s[n:n + 3]) > 1:
			print('{} {}'.format(n + 1, n + 3))
			return
print('-1 -1')


def resolve():
	S = list(input())
	if len(S) == 2:
		if S[0] == S[1]:
			print(1, 2)
		else:
			print(-1, -1)
		return
	for i in range(len(S) - 2):
		if S[i] == S[i + 1] or S[i + 1] == S[i + 2] or S[i + 2] == S[i]:
			print(i + 1, i + 3)
			return
	print(-1, -1)

def __starting_point():
	resolve()
__starting_point()


s = input()
if s[0] == s[1]:
	print(1, 2)
	return
ans = [-1, -1]
for i in range(2, len(s)):
	if s[i] == s[i - 2]:
		ans = [i - 1, i + 1]
		break
	elif s[i] == s[i - 1]:
		ans = [i, i + 1]
		break
print(*ans)


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return list(map(int, stdin.readline().split()))

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def check(n, l):
	s = 0
	for i in range(len(l)):
		s += (l[i] - n) * (l[i] - n)
	return s

def solve():
	s = input()
	n = len(s)
	for i in range(n - 1):
		if s[i] == s[i + 1]:
			print((i + 1, i + 2))
			return
	for i in range(n - 2):
		if s[i] == s[i + 2]:
			print((i + 1, i + 3))
			return
	print((-1, -1))
for _ in range(1):
	solve()


s = input()
n = len(s)
for i in range(n - 1):
	t = s[i:i + 2]
	if t[0] == t[-1]:
		print((i + 1, i + 2))
		return
for i in range(n - 2):
	t = s[i:i + 3]
	if t[0] == t[-1] and t[0] != t[1]:
		print((i + 1, i + 3))
		return
print((-1, -1))


import sys
s = input()
z = True
for i in range(len(s)):
	if not z:
		break
	try:
		if s[i] == s[i + 1]:
			print((i + 1, i + 2))
			z = False
			return
		if s[i] == s[i + 2]:
			print((i + 1, i + 3))
			z = False
			return
	except:
		pass
if z:
	print((-1, -1))


S = input()
(a1, a2) = (-1, -1)
for i in range(26):
	t = chr(ord('a') + i)
	s0 = ''
	s1 = ''
	for (j, s2) in enumerate(S):
		if s2 == t:
			if s2 == s1:
				(a1, a2) = (j, j + 1)
				break
			elif s2 == s0:
				(a1, a2) = (j - 1, j + 1)
				break
		(s0, s1) = (s1, s2)
	else:
		continue
	break
print((a1, a2))


import re
text = input()
for i in list('abcdefghijklmnopqrstuvwxyz'):
	match_object = re.search('{0}.?{0}'.format(i), text)
	if match_object:
		print(str(match_object.start() + 1) + ' ' + str(match_object.end()))
		return
print('-1 -1')


import re
s = input()
set_s = set(s)
flag = 0
if len(s) == 2:
	if s[0] == s[1]:
		print(1, 2)
		flag = 1
	else:
		flag = 1
		print(-1, -1)
for x in set_s:
	regex1 = re.compile(x + x + '\\w')
	regex2 = re.compile(x + '\\w' + x)
	mo1 = regex1.search(s)
	mo2 = regex2.search(s)
	if mo1:
		print(mo1.start() + 1, mo1.end())
		flag = 1
		break
	elif mo2:
		print(mo2.start() + 1, mo2.end())
		flag = 1
		break
if not flag:
	print(-1, -1)


s = input()
if len(s) == 2:
	if s[0] == s[1]:
		print(1, 2)
	else:
		print(-1, -1)
else:
	for i in range(len(s) - 2):
		temp = {}
		for j in range(3):
			temp.setdefault(s[i + j], 0)
			temp[s[i + j]] += 1
		if max(temp.values()) >= 2:
			print(i + 1, i + 3)
			break
	else:
		print(-1, -1)


s = input()
for i in range(len(s) - 2):
	if len(set(s[i:i + 3])) <= 2:
		print(i + 1, i + 3)
		break
else:
	if s[0] == s[1]:
		print(1, 2)
	else:
		print(-1, -1)


import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
S = input()
L = len(S)

def p():
	for j in range(L - 2):
		if S[j] == S[j + 1]:
			print(j + 1, j + 2)
			return
		if S[j] == S[j + 2]:
			print(j + 1, j + 3)
			return
	if S[-2] == S[-1]:
		print(L - 1, L)
	else:
		print(-1, -1)
p()


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	S = readline().strip()
	N = len(S)
	for i in range(N - 2):
		if S[i] == S[i + 1] or S[i] == S[i + 2]:
			print((i + 1, i + 3))
			return
	if S[N - 2] == S[N - 1]:
		print((N - 1, N))
		return
	print((-1, -1))
	return

def __starting_point():
	main()
__starting_point()


txt = input()
L = len(txt)

def solve():
	for i in range(L - 1):
		if txt[i] == txt[i + 1]:
			return ' '.join([str(x) for x in [i + 1, i + 2]])
	for i in range(L - 2):
		if txt[i] == txt[i + 2]:
			return ' '.join([str(x) for x in [i + 1, i + 3]])
	return '-1 -1'
ans = solve()
print(ans)


def check(l, r):
	th = 1 + (r - l + 1) // 2
	for i in range(26):
		if cnt[i] >= th:
			return True
	return False
s = input()
n = len(s)
si = [0] * n
for i in range(n):
	si[i] = ord(s[i]) - 97
(l, r) = (0, 1)
cnt = [0] * 26
for i in range(2):
	cnt[si[i]] += 1
while l < n - 1 and r < n:
	if check(l, r):
		print(l + 1, r + 1)
		return
	elif max(cnt) == 1 + (r - l + 1) // 2 or r - l == 1:
		r += 1
		if r < n:
			cnt[si[r]] += 1
	else:
		cnt[si[l]] -= 1
		l += 1
print(-1, -1)