Problem:
 Score : 400 points    Problem Statement 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 1 needed      Sample Output 1 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.       Sample Input 2 atcoder      Sample Output 2 -1 -1  The string atcoder contains no unbalanced substring.

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

s = input()[:-1]
a,b = -1,-1

for i in range(1,len(s)):
    if i >= 2:
        if s[i] == s[i-1]:
            a = i
            b = i+1
            break
        if s[i] == s[i-2]:
            a = i-1
            b = i+1
            break

    else:
        if s[i] == s[i-1]:
            a = i
            b = i+1
            break
print(a,b)

Solution (Python):
def solve(s):
    n = len(s)
    for i in range(n - 1):
        if s[i] == s[i + 1]:
            return '{} {}'.format(i + 1, i + 2)

    for i in range(n - 2):
        if s[i] == s[i + 2]:
            return '{} {}'.format(i + 1, i + 3)

    return '-1 -1'


s = input()
print(solve(s))

Solution (Python):
S = input()
def f(S):
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            return "{} {}".format(i+1, i+2)
        elif i < len(S)-2 and S[i] == S[i+2]:
            return "{} {}".format(i+1, i+3)
        else:
            pass
    return "-1 -1"
print(f(S))

Solution (Python):
s = list(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 s[i] == s[i + 1] or s[i + 1] == s[i + 2] or s[i + 2] == s[i]:
            ans = [i + 1, i + 3]
            break
print(ans[0], ans[1])

Solution (Python):
s = list(input())
ans = [-1, -1]
if len(s) == 2:
    if s[0] == s[1]:
        ans = [1, 2]
else:
    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]:
            ans = [i + 1, i + 3]
            break
print(ans[0], ans[1])

Solution (Python):
s = input()
n = len(s)

flg = True
for i in range(n-1):
    if s[i] == s[i+1]:
        flg = False
        print(i+1, i+2)
        break

if flg:
    for i in range(n-2):
        if s[i] == s[i+2]:
            flg = False
            print(i+1, i+3)
            break

if flg:
    print(-1, -1)

Solution (Python):

import collections


def solve(string):
    n = len(string)
    i = 0

    while i < n:
        count = collections.Counter(string[i:min(n, i+3)])

        for key, count in count.items():
            if count >= 2:
                return (i, min(n-1, i+2))

        i += 1

    return (-1, -1)


string = input().strip()

left, right = solve(string)

if left == -1 and right == -1:
    print(left, right)
else:
    print(left+1, right+1)

Solution (Python):
s=input()

s=list(s)

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

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

Solution (Python):
s = list(input())

start = 0

found = False

if len(s) == 2:
  if s[0] == s[1]:
    end = 1
    found = True
else:
  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]:
      end = i + 2
      found = True
      break
    else:
      start += 1

if not found:
  start = -2
  end = -2

print(start+1, end+1)

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

Solution (Python):
S = input()

s = S[0]
for i in range(1, len(S)+1):
    if (i == len(S)):
        break
    if S[i] == s:
        print(i, i+1)
        break
    elif i < len(S)-1 and S[i+1] == s:
        print(i, i+2)
        break
    s = S[i]

if (i == len(S)):
    print(-1, -1)

Solution (Python):
s = input()
n = len(s)

for i in range(n - 1):
    if s[i] == s[i + 1]:
        print(i + 1, i + 2)
        exit()

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

print(-1, -1)

Solution (Python):
s = input()
n = len(s)
if n == 2 and s[0] == s[1]:
    print(1,2)
    exit()
for i in range(n-2):
    if s[i] == s[i+1] or s[i] == s[i+2] or s[i+1] == s[i+2]:
        print(i+1,i+3)
        exit()
print(-1,-1)

Solution (Python):
def solve(str):
  for idx, s in enumerate(str):
    if idx+1 < len(str) and s == str[idx+1]:
      return idx+1, idx+2
    elif idx+2 < len(str) and s == str[idx+2]:
      return idx+1, idx+3
  return -1, -1

if __name__ == "__main__":
  s = input()
  first, last = solve(s)
  print(first, last)

Solution (Python):

import sys
input = sys.stdin.readline










S = input().rstrip()

N = len(S)
ans = [-1,-1]


for i in range(N-1):
    if S[i] == S[i+1]:
        ans = [i+1,i+2]
        break


for i in range(N-2):
    if S[i] == S[i+2]:
        ans = [i+1, i+3]
        break




print(ans[0], ans[1])

Solution (Python):
s = list(input())
n = len(s)
ans_1 = -1
ans_2 = -1
if n == 2:
  if s[0] == s[1]:
    ans_1 = 1
    ans_2 = 2
else:
  for i in range(n-2):
    if s[i] == s[i+1]:
      ans_1 = i+1
      ans_2 = i+2
      break
    elif s[i] == s[i+2]:
      ans_1 = i+1
      ans_2 = i+3
      break
print(ans_1,ans_2)

Solution (Python):
from sys import exit

s = input()
l = len(s)

for i in range(l-2):
  if s[i] == s[i+1]:
    print(i+1, i+3)
    exit()
  if s[i] == s[i+2]:
    print(i+1, i+3)
    exit()

if s[l-2] == s[l-1]:
  print(l-1, l)
else:
  print(-1, -1)

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    d = collections.defaultdict(list)
    s = S()
    for i, c in enumerate(s):
        d[c].append(i)
    for key, li in d.items():
        for i in range(len(li)-1):
            if li[i+1] - li[i] + 1 < 2 * 2:
                print(li[i]+1, li[i+1]+1)
                return
    print(-1, -1)
    return
main()

Solution (Python):
s = input()
l = len(s)
for i in range(l-1):
    if s[i] == s[i+1]:
        print(i+1, i+2)
        exit()
for i in range(l-2):
    if s[i] == s[i+2]:
        print(i+1, i+3)
        exit()
print(-1,-1)

Solution (Python):
s = str(input())
n = len(s)
for i in range(n-1):
    if s[i] == s[i+1]:
        print(i+1, i+2)
        exit()

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

print(-1, -1)

Solution (Python):
def main():

    s = str(input())
    n = len(s)

    cum = [[0]*(n+1) for _ in range(26)]

    for i in range(26):
        c = chr(i + ord('a'))
        for j in range(n):
            if s[j] == c:
                cum[i][j+1] = cum[i][j]+1
            else:
                cum[i][j+1] = cum[i][j]


    for i in range(26):
        for j in range(n+1):
            cum[i][j] = 2*cum[i][j] -j

    from collections import deque

    for i in range(26):
        min_ = 10**6
        min_id = -1
        q = deque()
        for j in range(n+1):
            if j == 0:
                q.append((cum[i][j], j))
            elif j == 1:
                q.append((cum[i][j], j))
            else:
                temp, temp_id = q.popleft()
                if temp <= min_:
                    min_ = temp
                    min_id = temp_id
                if cum[i][j] - min_ > 0:
                    print(min_id+1, j)
                    exit()
                q.append((cum[i][j], j))
    else:
        print(-1, -1)

if __name__ == '__main__':
    main()

Solution (Python):
s = str(input())
n = len(s)

cum = [[0]*(n+1) for _ in range(26)]

for i in range(26):
    c = chr(i + ord('a'))
    for j in range(n):
        if s[j] == c:
            cum[i][j+1] = cum[i][j]+1
        else:
            cum[i][j+1] = cum[i][j]


for i in range(26):
    for j in range(n+1):
        cum[i][j] = 2*cum[i][j] -j

from collections import deque

for i in range(26):
    min_ = 10**6
    min_id = -1
    q = deque()
    for j in range(n+1):
        if j == 0:
            q.append((cum[i][j], j))
        elif j == 1:
            q.append((cum[i][j], j))
        else:
            temp, temp_id = q.popleft()
            if temp <= min_:
                min_ = temp
                min_id = temp_id
            if cum[i][j] - min_ > 0:
                print(min_id+1, j)
                exit()
            q.append((cum[i][j], j))
else:
    print(-1, -1)

Solution (Python):
s = list(str(input()))
N = len(s)

if N == 2:
    if s[0] == s[1]:
        print(1,2)
    else:
        print(-1,-1)
else:   
    det = 0
    for i in range(N-3):
        if s[i] == s[i+1] or s[i] == s[i+2] or s[i+1] == s[i+2]:
            print(i+1,i+3)
            det = 1
            break

    if det == 0:
        print(-1,-1)

Solution (Python):
s = input()
n = len(s)
ans = (-1, -1)
for i in range(n-1):
    ts = s[i:i+2]
    if len(set(ts))==1:
        ans = (i+1, i+2)
        print(*ans)
        exit()
    
for i in range(n-2):
    ts = s[i:i+3]
    a,b,c = ts[0], ts[1], ts[2]
    if (a==b and b!=c) or (b==c and c!=a) or (c==a and a!=b):
        ans = (i+1, i+3)
        break
print(*ans)

Solution (Python):
import sys
t = input()
l = len(t)
for i in range(l-1):
    if t[i] == t[i+1]:
        print(i+1,i+2)
        sys.exit()
for i in range(l-2):
    if t[i] == t[i+2]:
        print(i+1,i+3)
        sys.exit()
print(-1,-1)

Solution (Python):
from collections import defaultdict

S = input()
d = defaultdict(lambda: -3)
for i, s in enumerate(S):
    if i - d[s] <= 2:
        print(d[s] + 1, i + 1)
        break
    else:
        d[s] = i
else:
    print(-1, -1)

Solution (Python):

import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(s: str):
    N = len(s)

    for i in range(N):
        if i == 0:
            continue

        if s[i-1] == s[i]:
            print(i, i+1)
            return

        if i > 1:
            if s[i-2] == s[i]:
                print(i-1, i+1)
                return
    print("-1 -1")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  
    solve(s)


if __name__ == '__main__':
    main()

Solution (Python):
"""


in1 = kari1
"""
in1 = input()

RC = '-1 -1'

str1 = in1[0]
str2 = in1[1]

if str1 != str2:
    idx1 = 0
    for idx1 in range(2, len(in1) - 2):
        if   in1[idx1] == str1:
            RC = str(idx1 - 1) + ' ' + str(idx1 + 1)
            break
        elif in1[idx1] == str2:
            RC = str(idx1) + ' ' + str(idx1 + 1)
            break
        else:
            str1 = str2
            str2 = in1[idx1]
elif str1 == str2:
    RC = '1 2'

print(RC)

Solution (Python):
import sys
s=str(input())
l=len(s)
for i in range(l-1):
  if s[i]==s[i+1]:
    print(' '.join([str(i+1),str(i+2)]))
    sys.exit()
  else:
    if i+2<=l-1:
      if s[i]==s[i+2]:
        print(' '.join([str(i+1),str(i+3)]))
        sys.exit()
    else:
      pass
print(' '.join(['-1','-1']))

Solution (Python):
import sys
INF = 10**10
MOD = 10**9 + 7
sys.setrecursionlimit(100000000)
from functools import lru_cache
from itertools import permutations
from math import factorial


def main():
    s = input()
    n = len(s)
    flag = False
    ans = (-1,-1)
    for i in range(n - 1):
        if s[i] == s[i + 1]:
            flag = True
            ans = (i + 1,i + 2)
            break
    
    if flag:
        print(*ans)
        exit()
    
    else:
        for i in range(n - 2):
            if s[i] == s[i + 2]:
                flag = True
                ans = (i + 1,i + 3)
                break

    print(*ans)

if __name__=='__main__':
    main()

Solution (Python):

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

def main():
    mod=10**9+7
    s=input()
    N=len(s)
    ans=[-1,-1]
    for i in range(N-1):
        if s[i]==s[i+1]:
            ans=[i+1,i+2]
            break
        
    for i in range(N-2):
        if s[i]==s[i+2]:
            ans=[i+1,i+3]
            
    print(' '.join(map(str, ans)))

main()

Solution (Python):
import collections
s = input()
l = len(s)
for i in range(l-1):
	t = s[i:i+3]
	c = collections.Counter(t)
	if s[i] == s[i+1]:
		print (i+1,i+2)
		exit()
	if c.most_common()[0][1] >= 2:
		print (i+1,i+3)
		exit()
print (-1,-1)

Solution (Python):
import collections
s = input()
l = len(s)
for i in range(l-1):
	t = s[i:i+3]
	c = collections.Counter(t)
	if s[i] == s[i+1]:
		print (i+1,i+2)
		exit()
	if c.most_common()[0][1] >= 2:
		print (i+1,i+3)
		exit()
print (-1,-1)

Solution (Python):
S=input()
l=len(S)
for i in range(l-1):
    if S[i]==S[i+1]:
        print(i+1,i+2)
        exit()
for i in range((l+1)//2-1):
    if S[i*2]==S[i*2+2]:
        print(i*2+1,i*2+3)
        exit()
for i in range(l//2-1):
    if S[i*2+1]==S[i*2+3]:
        print(i*2+2,i*2+4)
        exit()
print(-1,-1)

Solution (Python):
s = input()

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

Solution (Python):
s=input()
if len(s)==2:
  if s[0]==s[1]:
    print(1,2)
  else:
    print(-1,-1)
else:
  for i,(a,b,c) in enumerate(zip(s,s[1:],s[2:])):
    tmp=set([a,b,c])
    if len(tmp)!=3:
      print(i+1,i+3)
      exit()
  print(-1,-1)

Solution (Python):
s = input()
n = len(s)
for k in range(1, 3):
    for i in range(n-k):
        if s[i+k] == s[i]:
            print(i+1, i+1+k)
            exit()
print(-1, -1)

Solution (Python):
def main():
    S = input()
    n = len(S)
    S += '  '
    for i in range(n):
        if S[i] == S[i+1]:
            print('%d %d' %(i+1, i+2))
            return
        elif S[i] == S[i+2]:
            print('%d %d' %(i+1, i+3))
            return

    print('-1 -1')

main()

Solution (Python):

s = input()
s_list = list(s)
s_length = len(s)
for i in range(0,s_length-1):
    if s_list[i] == s_list[i+1]:
        print(str(i+1)+" "+str(i+2))
        exit()
for i in range(0,s_length-2):
    if s_list[i] == s_list[i+2]:
        print(str(i+1)+" "+str(i+3))
        exit()

print(str(-1)+" "+str(-1))

Solution (Python):
import sys
readline = sys.stdin.buffer.readline

s = readline().rstrip().decode('utf-8')

for i in range(1,len(s)):
    if s[i] == s[i-1]:
        print(i,i+1)
        exit()
for i in range(2,len(s)):
    if s[i] == s[i-2]:
        print(i-1,i+1)
        exit()
print(-1,-1)

Solution (Python):
s = list(input())

alpha = [[0 for i in range(2)] for j in range(26)]

def conv(t):
    if t == 'a':
        return 0
    elif t == 'b':
        return 1
    elif t == 'c':
        return 2
    elif t == 'd':
        return 3
    elif t == 'e':
        return 4
    elif t == 'f':
        return 5
    elif t == 'g':
        return 6
    elif t == 'h':
        return 7
    elif t == 'i':
        return 8
    elif t == 'j':
        return 9
    elif t == 'k':
        return 10
    elif t == 'l':
        return 11
    elif t == 'm':
        return 12
    elif t == 'n':
        return 13
    elif t == 'o':
        return 14
    elif t == 'p':
        return 15
    elif t == 'q':
        return 16
    elif t == 'r':
        return 17
    elif t == 's':
        return 18
    elif t == 't':
        return 19
    elif t == 'u':
        return 20
    elif t == 'v':
        return 21
    elif t == 'w':
        return 22
    elif t == 'x':
        return 23
    elif t == 'y':
        return 24
    elif t == 'z':
        return 25
index = 0
for i in s:

    if alpha[conv(i)][0] == 0:
        alpha[conv(i)][0] = 1
        alpha[conv(i)][1] = index
    else:
        alpha[conv(i)][0] += 1
        if index-alpha[conv(i)][1]+1 < 2*alpha[conv(i)][0]:
            print(alpha[conv(i)][1]+1,index+1)
            exit()
        else:
            alpha[conv(i)][0] = 1
            alpha[conv(i)][1] = index
    index += 1


print(-1,-1)

Solution (Python):
s = input()

for i, (e1, e2) in enumerate(zip(s, s[1:]), 1):
    if e1 == e2:
        print(i, i + 1)
        exit()

for i, (e1, e2, e3) in enumerate(zip(s, s[1:], s[2:]), 1):
    if e1 == e3:
        print(i, i + 2)
        exit()

print(-1, -1)

Solution (Python):
import sys
input = sys.stdin.readline

s = input().rstrip()
N = len(s)

for i in range(N):
    if i + 2 >= N:
        continue
    if s[i] == s[i + 1] or s[i + 1] == s[i + 2] or s[i + 2] == s[i]:
        print(i + 1, i + 3)
        sys.exit()

if s[-1] == s[-2]:
    print(N - 1, N)
    sys.exit()

print(-1, -1)

Solution (Python):
s =str(input())

if len(s) == 2:
    if s[0]==s[1]:
        sIndex = 1
        eIndex = 2
    else:
        sIndex = -1
        eIndex = -1
elif len(s)>2:
    sIndex=-1
    eIndex=-1
    for i in range(len(s)-2):
        par_str = s[i:i+3]
        if (par_str.count(par_str[0])>=2) | (par_str.count(par_str[1])>=2):
            sIndex = i + 1
            eIndex = i + 3
            break
    
ans = str(sIndex)+' '+str(eIndex)
print(ans)

Solution (Python):
s = str(input())

if len(s) == 2:
    if s[0] ==s[1]:
        start_ind =1
        end_ind = 2
    else:
        start_ind = -1
        end_ind = -1
        
elif len(s)>2:
    start_ind = -1
    end_ind = -1
    for i in range(len(s)-2):
        par_str = s[i:i+3]
        if (par_str.count(par_str[0])>=2) | (par_str.count(par_str[1])>=2):
            start_ind = i + 1
            end_ind = i + 3
            break
        
        

ans = str(start_ind) + ' ' + str(end_ind)

print(ans)

Solution (Python):
s = input()
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        print("{} {}".format(i+1, i+2))
        exit()
    if i < len(s) - 2:
        if s[i] == s[i+2]:
            print("{} {}".format(i+1, i+3))
            exit()
print("{} {}".format(-1,-1))

Solution (Python):
import sys, math

def input():
    return sys.stdin.readline()[:-1]

def main():
    s = input()
    for k in range(1,len(s)):
        if s[k-1] == s[k]:
            print(k,k+1)
            exit(0)
    for k in range(1,len(s)-1):
        if s[k-1] == s[k+1]:
            print(k,k+2)
            exit(0)
    print("-1 -1")
if __name__ == '__main__':
    main()

Solution (Python):
import sys

word=input()

for char in [chr(ord('a') + i) for i in range(26)]:
    left=-10**6
    for right,s in enumerate(word):
        if s == char:
            if 1 <= right - left <=2:
                print(left+1,right+1)
                sys.exit()
            else:
                left = right
else:
    print(-1,-1)

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

Solution (Python):
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):
        
        if len(set(s[i:i+3])) < 3:
            print(i+1,i+3)
            exit()
    print(-1,-1)

Solution (Python):
import sys
s=input()

flag=False
ans=[]
for i in range(len(s)):
  if i+1<len(s) and (s[i]==s[i+1]):
    ans=[i,i+1]
    flag=True
    break
if flag:
  print(ans[0]+1,ans[1]+1)
  sys.exit()
for i in range(len(s)):
  if i+2<len(s) and (s[i]==s[i+2]):
    ans=[i,i+2]
    flag=True
    break
print(ans[0]+1,ans[1]+1) if flag==True else print("-1 -1")

Solution (Python):
s = str(input())

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

Solution (Python):


x = -1
y = -1
S = list(input())

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        x = i+1
        y = x+1
        break
    elif i+2<=len(S)-1:
        if S[i] == S[i+2]:
            x = i+1
            y = x+2
            break
        else:
            pass
    else:
        pass
print(x, y)

Solution (Python):
s=input()
for i in range(1,len(s),1):
	if s[i]==s[i-1]:
		print(str(i)+" "+str(i+1))
		break
	try:
		if s[i-1]==s[i+1]:
			print(str(i)+" "+str(i+2))
			break
	except:
		pass
else :
	print(str(-1)+" "+str(-1))

Solution (Python):

import sys


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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  
    solve(s)


if __name__ == '__main__':
    main()

Solution (Python):
S = list(map(str, input()))

def f():
	for i in range(1, len(S)):
		if S[i - 1] == S[i]:
			return i, i + 1
	for i in range(2, len(S)):
		if S[i - 2] == S[i - 1] or S[i - 1] == S[i] or S[i - 2] == S[i]:
			return i - 1, i + 1
	return -1, -1
			
print(*f())

Solution (Python):
s = input()


for i in range(len(s)-1):
    if s[i] == s[i+1]:
        print(i+1,i+2)
        exit()


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

print("-1 -1")

Solution (Python):
s = input()
m = ord('a')
for i in range(26):
  c = chr(m+i)
  pj = -1
  flag = False
  for j, d in enumerate(s):
    if d!=c:
      continue
    if pj!=-1 and j-pj<3:
      print(pj+1,j+1)
      import sys
      sys.exit()
    pj = j
print(-1,-1)

Solution (Python):
s = input()
flag = False
for i in range(len(s)-1) :
    if s[i] == s[i+1] :
        flag = True
        print(i+1, i+2)
        break
if flag == False :
    for i in range(len(s)-2) :
        if s[i] == s[i+2] :
            flag = True
            print(i+1, i+3)
            break
if not flag :
    print("-1 -1")

Solution (Python):
s = input()
ans = [-1, -1]

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        ans = [i+1, i+2]
        break

for i in range(len(s)-2):
    if s[i] == s[i+2]:
        ans = [i+1, i+3]
        break

print(ans[0], ans[1])

Solution (Python):
s = input()
length = len(s)

if length == 2:
    print('1 2') if s[0] == s[1] else print('-1 -1')
else:
    end = 0
    for i in range(length-2):
        if s[i] == s[i+1] :
            end = 1
            print(str(i + 1) + ' ' + str(i + 2))
            break

        if s[i] == s[i+2] :
            end = 1
            print(str(i + 1) + ' ' + str(i + 3))
            break


    if end == 0 :
        print('-1 -1')

Solution (Python):
from itertools import accumulate
def run_length(data, init=''):
    length = []
    tmp = init
    cnt = 0
    for c in data:
        if tmp != c:
            length.append(cnt)
            cnt = 0
        tmp = c
        cnt += 1
    length.append(cnt)
    return length

s = input()
x = run_length(s)
acc = list(accumulate(x))



if len(x) == 2:
    print(1, 2)
    exit()
for i in range(1,len(acc)):
    if x[i] > 1:
        print(acc[i-1]+1, acc[i])
        break
else:
    for i in range(1,len(s)-1):
        if s[i-1] == s[i+1]:
            print(i, i+2)
            break
    else:
        print(-1, -1)

Solution (Python):
s = input()

a = s[0]
b = s[1]
if len(s) == 2:
  print('1 2' if  a==b else '-1 -1')
  exit(0)
  
for i in range(2,len(s)):
  c = s[i]
  if c in (a,b):
    print('{} {}'.format(i-1,i+1) if a==c else '{} {}'.format(i,i+1))
    break
  else:
    a = b
    b = c
else:
  print(-1, -1)

Solution (Python):
S = input()
N = len(S)

l, r = -2, -2
if S[0] == S[1]:
    l, r = 0, 1
else:
    for i in range(2, N):
        if S[i-1] == S[i]:
            l, r = i-1, i
            break
        elif S[i-2] == S[i]:
            l, r = i-2, i
            break
print(l+1, r+1)

Solution (Python):
import sys
sys.stdin.readline

def main():
    S = input()
    alpha = [chr(i+ord("a")) for i in range(26)]
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            return i+1, i+2
    for i in range(len(S)-2):
        if S[i] == S[i+2]:
            return i+1, i+3
    return -1, -1

if __name__ == "__main__":
    print(*main())

Solution (Python):
S = input()
for i in range(len(S)-2):
  for j in [i+1,i+2]:
    if S[i] == S[j]:
      print(i+1,j+1)
      exit()
if len(S) == 2 and S[0]==S[1]:
  print(1,2)
  exit()
print('-1 -1')

Solution (Python):
s = input()

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

if s[len(s)-2] == s[len(s)-1]:
    print(len(s)-1, len(s))
else:
    print(-1, -1)

Solution (Python):
s = input()
flag = True
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    flag = False
    print(i+1, i+2)
    break
if flag:
  for i in range(len(s)-2):
    if s[i] == s[i+2]:
      flag = False
      print(i+1, i+3)
      break
if flag:
  print(-1, -1)

Solution (Python):
S=input()
N=len(S)
ans = '-1 -1'
for i in range(N):
  if i+1<N:
    if S[i]==S[i+1]:
      ans = '{} {}'.format(i+1,i+2)
      break
  if i+3<=N:
    if S[i]==S[i+2]:
      ans = '{} {}'.format(i+1,i+3)
      break
print(ans)

Solution (Python):


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

Solution (Python):
import sys

S=input()
L=list('abcdefghijklmnopqrstuvwxyz')

for i in L:
    if S.count(i+i):
        n=S.index(i+i)
        print(n+1,n+2)
        sys.exit()

for i in L:
    for j in L:
        if S.count(i+j+i):
            n=S.index(i+j+i)
            print(n+1,n+3)
            sys.exit()

print(-1,-1)

Solution (Python):
from sys import exit
s=input()
l=len(s)
for i in range(l-2):
    if s[i]==s[i+2]:
        print(str(i+1)+" "+str(i+3))
        exit()
    if s[i]==s[i+1]:
        print(str(i+1)+" "+str(i+2))
        exit()
if s[l-2]==s[l-1]:
    print(str(l-1)+" "+str(l))
else:
    print("-1 -1")

Solution (Python):
def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2
s1=list(input())
l=len(s1)
s2=groupby(s1)
now=0
for i in s2:
    now+=i[1]
    if i[1]!=1:
        print(str(now-i[1]+1)+" "+str(now))
        break
else:
    if l==2:
        print("-1 -1")
    else:
        for i in range(l-2):
            if s1[i]==s1[i+2]:
                print(str(i+1)+" "+str(i+3))
                break
        else:
            print("-1 -1")

Solution (Python):
s = input()

length = len(s)
f = 0

for p in range(length-1):
    for q in range(p+2,p+4):
        hikaku = s[p:q]
        
        for i in range(len(hikaku)):
            num = hikaku.count(hikaku[i])
            if num > len(hikaku)/2:
                print(str(p+1) + ' ' + str(q))
                f = 1
                break
        if f == 1:
            break
    if f == 1:
        break
if f == 0:
    print('-1 -1')

Solution (Python):
import sys
input = sys.stdin.readline
s=input().strip()
if len(s)==2:
    if s[0]==s[1]:
        print(1,2)
        exit()
for i in range(len(s)-2):
    if len(set(s[i:i+3]))<3:
        print(i+1,i+3)
        exit()
print(-1,-1)

Solution (Python):
s = input()
n = len(s)
for k in range(1,n):
    if s[k-1] == s[k]:
        print(k,k+1)
        exit(0)
if n >= 3:
    for k in range(1,n-1):
        if s[k-1] == s[k+1]:
            print(k,k+2)
            exit(0)
print(-1,-1)

Solution (Python):
S = input() + '
n = len(S)
for idx, s1 in enumerate(S[:-2], 1):
    s2 = S[idx]
    s3 = S[idx+1]
    if s1 == s2:
        print(idx, idx+1)
        exit()
    elif s1 == s3:
        print(idx, idx+2)
        exit()
    elif s2 == s3:
        print(idx+1, idx+2)
        exit()
    else:
        continue
print(-1, -1)

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

Solution (Python):
from collections import defaultdict
S = input()
N = len(S)
d = defaultdict(list)
for i in range(N):
    d[S[i]].append(i)
ans = [-1,-1]
for s in d:
    l = []
    for i in range(len(d[s])):
        l.append([d[s][i]-2*i,i])
    l.sort()
    for i in range(len(l)-1):
        if l[i+1][1]<=l[i][1] or l[i+1][0]==l[i][0]:
            ans = [d[s][l[i+1][1]]+1,d[s][l[i][1]]+1]
ans.sort()
print(*ans)

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