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):
s=input().rstrip()
x=list(s)
if len(x)==1:
    print(-1,-1)
elif len(x)==2:
    if x[0]==x[1]:
        print(1,2)
    else:
        print(-1,-1)
else:
    G=0;
    for i in range(0,len(x)-3+1):
        t=x[i:i+3]
        if len(list(set(t)))==1 or len(list(set(t)))==2:
            print(i+1,i+3)
            G=1;
            break;
    if G==0:
        print(-1,-1)

Solution (Python):

import copy
import random
import bisect 
import fractions 
import math
import sys

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

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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())

s = str(input())

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        ans = [i,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):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

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

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






def main():
  s=S()

  ln=len(s)
  for i in range(len(s)-1):
    if s[i]==s[i+1]:
      return str(i+1)+' '+str(i+2)
    if i<ln-2:
      if s[i]==s[i+2]:
        return str(i+1)+' '+str(i+3)

  return '-1 -1'

print(main())

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

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


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

Solution (Python):

from collections import defaultdict
import sys
S=raw_input()
P=defaultdict(list)
for i,c in enumerate(S):
    P[c].append(i)
for c,v in P.items():
    v.sort()
    i=v[0]
    for ii in v[1:]:
        if ii-i==1 or ii-i==2:
            print("%d %d"%(i+1, ii+1))
            sys.exit(0)
        i=ii
print("%d %d"%(-1,-1))

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

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

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

if ans == None:
	print(-1,-1)

Solution (Python):




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

print(a, b)

Solution (Python):
s = input()

N = len(s)
a, b = -1, -1
if N == 2:
    if s[0] == s[1]:
        a, b = 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]:
            a, b = i + 1, i + 3
            break
print(a, b)

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

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

Solution (Python):
s=input()
if len(s)==2:
    print(["-1 -1","1 2"][s[0]==s[1]])
    exit()
x=len(s)
for i in range(x-2):
    chk=[s[i],s[i+1],s[i+2]]
    chk.sort()
    if chk[0]==chk[1] or chk[1]==chk[2]:
        print(i+1,i+3)
        exit()
print("-1 -1")

Solution (Python):
def d_unbalanced(S):
    S_length = len(S)
    s = S + '
    for i in range(S_length):
        
        
        if s[i] == s[i + 1]:  
            return '{} {}'.format(i + 1, i + 2)
        elif s[i] == s[i + 2]:  
            return '{} {}'.format(i + 1, i + 3)
    
    return '-1 -1'
 
S = input().strip()
print(d_unbalanced(S))

Solution (Python):
s = input()
j = -1
k = -1
for i in range(0, len(s) - 1):
    if s[i] == s[i + 1]:
        j, k = i + 1, i + 2
        break
    elif i + 2 < len(s) and s[i] == s[i + 2]:
        j, k = i + 1, i + 3
        break
print(str(j) + ' ' + str(k))

Solution (Python):
def solve(S):
    l=len(S)
    for i,s in enumerate(S[:-1]):
        if s==S[i+1]:
            return i+1,i+2
    for i,s in enumerate(S[:-2]):
        if s==S[i+2]:
            return i+1,i+3
    return -1,-1

S=input()
print(*solve(S))

Solution (Python):
def solve(S):
    l=len(S)
    for i,s in enumerate(S[:-1]):
        if s==S[i+1]:
            return i+1,i+2
    for i,s in enumerate(S[:-2]):
        if s==S[i+2]:
            return i+1,i+3
    return -1,-1

S=input()
print(*solve(S))

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()
ans = (-1,-1)
for i,c in enumerate(s[:-1]):
    if c==s[i+1]:
        ans = (i+1,i+2)
        break
else:
    for i,c in enumerate(s[:-2]):
        if c==s[i+2]:
            ans = (i+1,i+3)
            break
print(*ans)

Solution (Python):
S = input()

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

print(*solve(S))

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) - 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)
        exit()
print(-1, -1)

Solution (Python):
s=input()

t={s[0],s[1]}
K=[]
if len(s)==2 and len(t)==1:
    print('1 2')
    K.append(1)
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]:
            print(str(i+1)+' '+str(i+3))
            K.append(1)
            break

if K==[]:
    print('-1 -1')

Solution (Python):
s = input()
if len(s) == 2:
    if s[0] == s[1]:
        print("1 2")
        exit()
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]:
        print("{0} {1}".format(i+1, i+3))
        exit()
print("-1 -1")

Solution (Python):
s = input()
l = []
t = s[0]
m = 1
for i in range(1,len(s)):
    if s[i] == t:
        m += 1
    else:
        t = s[i]
        l.append(m)
        m = 1
l.append(m)

if len(l) == 1:
    print(1,l[0])
    exit()
if l[0] > 1:
    print(1,l[0]+l[1])
    exit()

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

ruiseki = [l[0]]
for i in range(1,len(l)):
    ruiseki.append(ruiseki[i-1] + l[i])

for i in range(len(ruiseki)-1):
    if ruiseki[i+1] - ruiseki[i] > 1:
        print(ruiseki[i],ruiseki[i+1])
        exit()

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    S = str(input().strip())
    N = len(S)

    for i in range(N):
        s0 = S[i]
        if i <= N-2 and s0 == S[i+1]:
            return '{} {}'.format(i+1, i+2)

        if i <= N-3 and s0 == S[i+2]:
            return '{} {}'.format(i+1, i+3)

    return '-1 -1'


if __name__ == '__main__':
    print(main())

Solution (Python):
S = input()


found = False
pprev, prev = S[0],S[1]
t = {pprev, prev}
if len(S) == 2 and len(t) == 1:
    print(1,2)
    found = True
for i in range(2,len(S)):
    t.add(S[i])
    if len(t) == 2:
        print(i - 1, i + 1)
        found = True
    else:
        t.remove(pprev)
    pprev = prev
    prev = S[i]
    t = {pprev, prev}
    if found:
        break
    
if not found:
    print(-1, -1)

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

Solution (Python):
def unbalanced(s: str) -> tuple:
    for i in range(len(s) - 1):
        c1, c2 = s[i], s[i + 1]
        if c1 == c2:
            return i+1, i+2
        if i + 2 < len(s):
            c3 = s[i + 2]
            if c1 == c3:
                return i+1, i+3
    return -1, -1


if __name__ == "__main__":
    s = input()
    a, b = unbalanced(s)
    print(a, b)

Solution (Python):
from sys import stdin
input = stdin.readline
s = input().rstrip()
for i in range(len(s)):
	if i <= len(s)-2 and s[i] == s[i+1]:
		print(i+1, i+2)
		break
	elif i <= len(s)-3 and s[i] == s[i+2]:
		print(i+1, i+3)
		break
else:
	print(-1, -1)

Solution (Python):
s = input()
s_len = len(s)
ans = '-1 -1'

for i in range(s_len):
    if i+1 < s_len and s[i] == s[i+1]:
        ans = '{} {}'.format(i+1, i+2)
        break
    elif i+2 < s_len and s[i] == s[i+2]:
        ans = '{} {}'.format(i+1, i+3)
        break
print(ans)

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


if __name__ == "__main__":
    main()

Solution (Python):
s = input()

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

print(-1, -1)

Solution (Python):


s = input()
N = len(s)

head = 0
tail = 1

notfound = True
while head <= N-2:
    if s[head] == s[tail]:
        print(head+1, tail+1)
        notfound = False
        break

    if tail+1 < N and s[head] == s[tail+1]:
        print(head+1, tail+2)
        notfound = False
        break

    head = head+1
    tail = tail+1

if notfound:
    print(-1, -1)

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

Solution (Python):




import re
s=input()
alphabet="abcdefghijklmnopqrstuvwxyz"
for i in alphabet:
    ba=s.find(i+i)
    if ba!=-1:
        print(str(ba+1)+" "+str(ba+2))
        break
    A=re.compile(i+"."+i)
    axa=A.search(s,0)
    if axa:
        ba=axa.start()
        print(str(ba+1)+" "+str(ba+3))
        break
    if i=="z":
        print("-1 -1")

Solution (Python):
s = list(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):
import sys
s = input()
if s[0] == s[1]:
    print(1, 2)
    sys.exit()

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

print(lans, rans)

Solution (Python):



n=input()
check=0
for i in range(len(n)-1):
    a=n[i:i+2]
    if a[0]==a[1]:
        check=1
        ans=i
        break

if check==0:
    for j in range(len(n)-2):
        b=n[j:j+3]
        if b[0]==b[1] or b[0]==b[2] or b[1]==b[2]:
            check=2
            ans=j
            break

if check==1:
    print(ans+1,ans+2)
if check==2:
    print(ans+1,ans+3)
if check==0:
    print(-1,-1)

Solution (Python):
S = input()
N = len(S)
if N == 2:
  if S[0] == S[1]:
    print(1,2)
    exit(0)
  else:
    print(-1, -1)
    exit(0)
    
for e,c in enumerate(S):
  if e+1 < len(S):
    b = S[e+1]
    if c == b:
      print(e+1, e+2)
      exit(0)
  
  if e+2 < len(S):
    b = S[e+2]
    if c == b:
      print(e+1, e+3)
      exit(0)
print(-1, -1)

Solution (Python):
s = input()

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

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

Solution (Python):

from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007








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

Solution (Python):
S = input()

def solve2():
    head = 0
    tail = 2
    while head < len(S):
        
        
        
        if S[head:tail][0:1] == S[head:tail][1:2]:
            return head + 1, tail
        head += 1
        tail += 1

    head = 0
    tail = 3
    while head < len(S):
        
        
        
        
        if S[head:tail][0:1] == S[head:tail][2:3]:
            return head + 1, tail
        head += 1
        tail += 1

    return -1, -1

res = solve2()
print(res[0], res[1])

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

print(solve(input()))

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

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

    return '-1 -1'


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

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):
        seg = s[i:i+3]
        if seg.count(seg[0]) >= 2 or seg.count(seg[1]) >= 2:
            print(i + 1, i + 3)
            break
    else:
        print(-1, -1)

Solution (Python):
s = input()

checker = ''

if len(s) == 2:
    if s[0] == s[1]:
        print(1, 2)
        checker += '*'
    else:
        print(-1, -1)
        checker += '*'


if checker == '':
    for a, b in zip(range(len(s)-1), range(1,len(s))):
        if s[a] == s[b]:
            print(a+1, b+1)
            checker += '*'
            break

if checker == '':
    for a, c in zip(range(len(s)-2), range(2, len(s))):
        if s[a] == s[c]:
            print(a+1, c+1)
            checker += '*'
            break

if checker == '':
    print(-1, -1)

Solution (Python):
def solve(s):
    for i, j in zip(range(0, len(s) - 1), range(1, len(s))):
        if s[i] == s[j]:
            return "%d %d" % (i + 1, j + 1)

    for i, j in zip(range(0, len(s) - 2), range(2, len(s))):
        if s[i] == s[j]:
            return "%d %d" % (i + 1, j + 1)

    return "%d %d" % (-1, -1)



print(solve(input()))

Solution (Python):


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()
N = len(S)

if N < 3:
    if S[0] == S[1]:
        print(1, 2)
    else:
        print(-1, -1)
    exit()

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

Solution (Python):
def solve(s):
    for i, j in zip(range(0, len(s) - 1), range(1, len(s))):
        if s[i] == s[j]:
            return "%d %d" % (i + 1, j + 1)

    for i, j in zip(range(0, len(s) - 2), range(2, len(s))):
        if s[i] == s[j]:
            return "%d %d" % (i + 1, j + 1)

    return "%d %d" % (-1, -1)


if __name__ == "__main__":
    print(solve(input()))

Solution (Python):
def solve(s):
    for i, j in zip(range(0, len(s) - 1), range(2, len(s)+1)):
        if s[i] == s[j - 1]:
            return "%d %d" % (i + 1, j)

    for i, j in zip(range(0, len(s) - 2), range(3, len(s)+1)):
        if s[i] == s[j - 1]:
            return "%d %d" % (i + 1, j)

    return "%d %d" % (-1, -1)

if __name__ == "__main__":
    print(solve(input()))

Solution (Python):
s = input().strip()
i=0
p=-1
while True:
  if i+2 == len(s):
    if s[i]==s[i+1]:
      p=1
      break
  elif i+1 == len(s):
    break
  else:
    if s[i] == s[i+1]:
      p=1
      break
    elif s[i] == s[i+2]:
      p=2
      break
  i+=1

if p==1:
  print(i+1, i+2)
elif p==2:
  print(i+1, i+3)
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):
mondai = input()
s=[]
for i in range(len(mondai)):
    s.append(mondai[i])
alpha = 'abcdefghijklmnopqrstuvwxyz'
def main(s):
    now=[]
    ind=len(s)
    for i in range(len(s)):
        x=s.pop()
        k = len(now)
        if k==0:now.append(x)
        if k==1:
            if x in now:return str(ind)+' '+str(ind+1)
            now.append(x)
        if k==2:
            if x in now:return str(ind)+' '+str(ind+2)
            if x not in now:
                now = now[1:]
                now.append(x)
        ind-=1
    return '-1 -1'
print(main(s))

Solution (Python):
s = input()

before = 0
before_2 = 1

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

else:
    print(-1, -1)

Solution (Python):
s = input()

before = 0
before_2 = 1

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

Solution (Python):
S = input()
N = len(S)
for i in range(N - 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[N - 2] == S[N - 1]:
    print(N - 1, N)
else:
    print(-1, -1)

Solution (Python):
s = input()
found = False
for i,c in enumerate(s[0:len(s)-2]):
    if c == s[i+1]:
        found = True
        print(str(i+1)+" "+str(i+2)) 
        break
    elif c == s[i+2]:
        found = True
        print(str(i+1)+" "+str(i+3))
        break
if found == False:
    if s[len(s)-2] == s[len(s)-1]:
        print(str(len(s)-1)+" "+str(len(s)))
    else:
        print("-1 -1")

Solution (Python):
import collections
s = input()
n = len(s)
k = list(s)

if n >= 3:
    for i in range(n - 2):
        tmpli = [s[i], s[i + 1], s[i + 2]]
        if len(set(tmpli)) != 3:
            print(i + 1, i + 3)
            exit()
    print(-1, -1)
else:
    if s[0] == s[1]:
        print(1, 2)
    else:
        print(-1, -1)

Solution (Python):
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] and S[i]!=S[i+1]:
        Ans = [i+1,i+3]
        break

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

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

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


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

Solution (Python):
def check(s):
    if len(s) < 2:
        return '{} {}'.format(-1, -1)
    elif len(s) == 2:
        if s[0] == s[1]:
            return '{} {}'.format(1, 2)
    for i in range(len(s)-2):
        a, b, c = s[i], s[i+1], s[i+2]
        if a == b:
            return '{} {}'.format(i+1, i+2)
        elif b == c:
             return '{} {}'.format(i+2, i+3)           
        elif a == c:
            return '{} {}'.format(i+1, i+3)
        else:
            continue
    else:
        return '{} {}'.format(-1, -1)

s = input()
print(check(s))

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


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

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

        
        
print(-1, -1)

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

for i in range(L):
    if i<L-1 and s[i]==s[i+1]:
        print(i+1,i+2)
        break
    if i<L-2 and s[i]==s[i+2]:
        print(i+1,i+3)
        break

else:
    print(-1,-1)

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

ans = [-1, -1]
flg = False
if LS < 2:
    flg = False
elif LS == 2:
    flg = S[0] == S[1]
    if flg: ans = [1, 2]
else:  
    for i in range(len(S) - 2):
        p1 = S[i] == S[i + 1]
        p2 = S[i] == S[i + 2]
        p3 = S[i + 1] == S[i + 2]
        flg = p1 or p2 or p3
        if flg:
            ans = [i + 1, i + 1 + 2]
            break
print(*ans)

Solution (Python):
s=input()
l=len(s)
for i in range(l-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[l-2]==s[l-1]:
  print(l-1,l)
  exit()
print(-1,-1)

Solution (Python):
s = input()
if len(s) > 2:
  for a in range(len(s)-2):
    if len(set(list(s[a:a+3]))) != len(s[a:a+3]):
      print(a+1, a+3)
      break
  else:
    print(-1, -1)

else:
  print(1, 2) if len(set(list(s))) != len(s) else print(-1,-1)

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

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

    if n == 2:
        if s[0] == s[1]:
            print(1, 2)
        else:
            print(-1, -1)
        exit()

    for i in range(n - 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()
    print(-1, -1)

main()

Solution (Python):
import sys
S = list(input())
if len(S) == 2 and S[0] == S[1]:
    print("%d %d" % (1, 2))
    sys.exit()

for i in range(len(S) - 2):
    subset = S[i:i+3]
    if subset[0] == subset[2] or subset[1] == subset[2]:
        print("%d %d" % (i+1, i+3))    
        sys.exit()

print("-1 -1")

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

if len(s)==2 and s[0]==s[1]:
    print(1,2)
    sys.exit()

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

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(1000000)



def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))



def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v



def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk



def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False



dp = None


def main():
    S = input()

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

    print(-1, -1)



main()

Solution (Python):
from collections import deque
s=input()

tmp=deque(['',''])
ans=[-1,-1]
for i,x in enumerate(s):
    if x in tmp:
        ans=[max(i-1,1),i+1]
        break
    else:
        tmp.pop()
        tmp.appendleft(x)
print('{0[0]} {0[1]}'.format(ans))

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

Solution (Python):
s = input()
i,j=1,0
from collections import defaultdict
d = defaultdict(lambda:0)
d[s[0]]+=1
d[s[1]]+=1
ans = '-1 -1'
while True:
    if 2*d[s[j]]>i-j+1:
        ans = str(j+1)+' '+str(i+1)
        break
    if 2*d[s[j]]==i-j+1 and i < len(s)-1:
        i+=1
        d[s[i]]+=1
    else:
        d[s[j]]-=1
        j+=1
        if j == len(s)-1:
            break
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()

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

print("-1 -1")

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

Solution (Python):
a=input()
if len(a)==1:
    print("-1 -1")
elif (len(a)==2)&(len(list(set(a)))==1):
    print("1 2")
else:
    for i in range(len(a)-2):
        e=list(set(a[i:i+3]))
        if (len(e)==2) or (len(e)==1):
            print("{}".format(i+1)+" "+"{}".format(i+3))
            break
    else:
        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(0)

for i in range(N - 2):
    if S[i] == S[i + 2]:
        print(i + 1, i + 3)
        exit(0)

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()
for i in range(1,len(s)):
    if s[i-1]==s[i]:
        print(i,i+1)
        exit()
for j in range(2,len(s)):
    if s[j-2]==s[j]:
        print(j-1,j+1)
        exit()
print(-1,-1)

Solution (Python):
x = list(input())
end = 0
for i in range(len(x)-1):
    if x[i] == x[i+1]:
        print(i+1,i+2)
        end += 1
        break
if end == 0:
    for j in range(len(x)-2):
        if x[j] == x[j+2]:
            print(j+1,j+3)
            end += 1
            break
if end == 0:
    print(-1,-1)

Solution (Python):
s = input()
n = len(s)
if s[0] == s[1]:
  print(1,2)
  exit()
for i in range(2,n):
  if 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)