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 collections
A = input()
for i in range(len(A)-1):
    B = A[i:i+2]
    C = collections.Counter(B)
    if C.most_common()[0][1] == 2:
        print(i+1,i+2)
        exit()
for i in range(len(A)-2):
    B = A[i:i+3]
    C = collections.Counter(B)
    if C.most_common()[0][1] == 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)
    exit()
  else:
    print(-1,-1)
    exit()
    
for i in range(len(s)-2):
  a=s[i:i+3]
  if len(set(a))!=3:
    print(i+1,i+3)
    exit()
print(-1,-1)

Solution (Python):
s=[c for c in 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):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s = readline().rstrip().decode()
if s[0] == s[1]:
    print(1, 2)
    exit()
for i, (af, s, bf) in enumerate(zip(s, s[1:], s[2:])):
    if af == s or af == bf or s == bf:
        print(i + 1, i + 3)
        exit()
print(-1, -1)

Solution (Python):
S = input()
for c in range(0, ord('z') - ord('a')+1):
    last_c = -1
    for i,s in enumerate(S):
        if ord(s) - ord('a') == c:
            if last_c == -1:
                last_c = i
                continue
            if i - last_c <= 2:
                print(last_c+1,i+1)
                exit()
            last_c = i
print(-1,-1)

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

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

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

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

print(-1,-1)

Solution (Python):



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

if __name__=='__main__':
  main()

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


if __name__ == '__main__':
    solve()

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()

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

Solution (Python):
S = input()
for i,(a,b) in enumerate(zip(S,S[1:])):
    if a==b:
        print(i+1,i+2)
        exit()
for i,(a,b) in enumerate(zip(S,S[2:])):
    if a==b:
        print(i+1,i+3)
        exit()
print(-1,-1)

Solution (Python):
s=input()

def c(a): return ord(a) - ord('a')

d=[-100]*26
for i,v in enumerate(s):
    if i-d[c(v)] <=1:
        print(i,i+1)
        exit()
    elif i-d[c(v)] <=2:
        print(i-1,i+1)
        exit()
    d[c(v)]=i
print(-1,-1)

Solution (Python):
s = input()

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

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):
import sys

def solve():
    input = sys.stdin.readline
    S = input().strip("\n")
    N = len(S)
    for i in range(N-1):
        if S[i] == S[i+1]:
            print(i+1, i+2)
            break
    else:
        for i in range(N-2):
            if S[i] == S[i+2]:
                print(i+1, i+3)
                break
        else:
            print(-1, -1)

    return 0

if __name__ == "__main__":
    solve()

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):
def main():
    s = input()

    for i, (a, b) in enumerate(zip(s, s[1:]), start=1):
        if a == b:
            print(i, i + 1)
            return

    for i, (a, b) in enumerate(zip(s, s[2:]), start=1):
        if a == b:
            print(i, i + 2)
            return

    print(-1, -1)


if __name__ == '__main__':
    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 = input()

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

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

left = 0
right = 0
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        left = i+1
        right = left+1
        break

for i in range(len(S)-2):
    if S[i]==S[i+2]:
        left = i+1
        right = left+2
        break

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

Solution (Python):
s = input()

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

Solution (Python):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


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

Solution (Python):
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



S = str(input())

d = defaultdict(list)
for i,s in enumerate(S):
    d[s].append(i)

for v in d.values():
    for i in range(1,len(v)):
        if v[i]-v[i-1] <= 2:
            print(v[i-1]+1,v[i]+1)
            exit()

print('-1 -1')

Solution (Python):
import sys


def main():
    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)

if __name__ == "__main__":
    main()

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

Solution (Python):
s=input()

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

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


if res:
    res=list(map(lambda x:x+1,res))
    print(res[0],res[1])
else:
    print("-1 -1")

Solution (Python):
s = input().strip()
for i in range(len(s)-1):
    if 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)

Solution (Python):


class Proc:
    def __init__(self):
        self.s = input().rstrip()

    def is_unbalance(self):
        for i in range(1, len(self.s)):
            if self.s[i] == self.s[i-1]:
                print(str(i-1 + 1) + " " + str(i+1))
                return
            if i < len(self.s) - 1:
                if self.s[i - 1] == self.s[i + 1]:
                    print(str(i-1+1) + " " + str(i+1+1))
                    return
        print("-1 -1")


Proc().is_unbalance()

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S=ST()
    for i,_ in enumerate(S):
        sub = S[i:i+2]
        if sub[0]==sub[-1] and len(sub)==2:
            print(i+1,i+2)
            return
        sub = S[i:i+3]
        if sub[0]==sub[-1] and len(sub)==3:
            print(i+1,i+3)
            return
        
    print(-1,-1)
if __name__ == '__main__':
    main()

Solution (Python):
def main():
    s = input().strip()
    for i in range(1, len(s)):
        if s[i] == s[i - 1]:
            print(i, i + 1)
            break
    else:
        for i in range(2, len(s)):
            if s[i] == s[i - 2]:
                print(i - 1, i + 1)
                break
        else:
            print(-1, -1)


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
for i,(a,b) in enumerate(zip(S,S[1:])):
    if a==b:
        print(i+1, i+2)
        exit()
for i,(a,b) in enumerate(zip(S,S[2:])):
    if a==b:
        print(i+1, i+3)
        exit()

print(-1, -1)

Solution (Python):
s=input()
u=len(s)
a=s[0]
b=s[1]
if(u==2 or a==b):
	print("1 2" if a==b else "-1 -1")
	exit(0)
for i in range(2,u):
	c = s[i]
	if a==c:
		print("{} {}".format(i-1,i+1))
		exit(0)
	if b==c:
		print("{} {}".format(i,i+1))
		exit(0)
	a=b
	b=c
print("-1 -1")

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy


from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush

sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) 
def inpm(): return map(int,input().split()) 
def inpl(): return list(map(int, input().split())) 
def inpls(): return list(input().split())  
def inplm(n): return list(int(input()) for _ in range(n)) 
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)] 
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    s = list(input())
    if len(s)==2 and (s[0]==s[1]):
        print(1,2)
        return
    elif len(s)==2:
        print(-1,-1)
        return
    dic = defaultdict(int)
    dic[s[0]] += 1
    dic[s[1]] += 1
    dic[s[2]] += 1
    for e in dic:
        if dic[e] >= 2:
            print(1,3)
            return
    for i in range(len(s)-3):
        dic[s[i]] -= 1
        dic[s[i+3]] += 1
        for e in dic:
            if dic[e] >= 2:
                print(i+2,i+4)
                return
    print(-1,-1)            

if __name__ == "__main__":
    main()

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


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def main():
    S = input()
    p1 = None
    p2 = None
    for i, s in enumerate(S):
        if s == p1:
            print(i, i + 1)
            return
        if s == p2:
            print(i - 1, i + 1)
            return
        p1, p2 = s, p1

    print(-1, -1)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True 

def ddprint(x):
  if DBG:
    print(x)

s = input().strip()
if len(s)<=2:
    if len(s)==2 and s[0]==s[1]:
        print('1 2')
    else:
        print('-1 -1')
    exit()
for i in range(2,len(s)):
    if s[i]==s[i-2]:
        print('{} {}'.format(i-1,i+1))
        exit()
    if s[i]==s[i-1]:
        print('{} {}'.format(i,i+1))
        exit()
print('-1 -1')

Solution (Python):
from collections import defaultdict
import numpy as np
S = input()

d = defaultdict(list)
for i, s in enumerate(S):
    d[s].append(i + 1)


ans = (-1, -1)
for k, v in d.items():
    dif = np.diff(v).tolist()
    if 1 in dif:
        i = dif.index(1)
        ans = (v[i], v[i + 1])
        break
    elif 2 in dif:
        i = dif.index(2)
        ans = (v[i], v[i + 1])
        break

print(*ans, sep=" ")

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(2, len(S)):
  if S[i-2] == S[i-1] or S[i-1] == S[i] or S[i-2] == S[i]:
    print(i-1, i+1)
    break
else:
  print(-1, -1)

Solution (Python):
import sys
from collections import deque
import time
import bisect
def input():
    return sys.stdin.readline()[:-1]
s=input()



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

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

print('-1 -1')

Solution (Python):
def main():
  s = input()
  if len(s) == 2 and s[0] == s[1]:
    print(1, 2)
    return
  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
  print(-1, -1)
  return

if __name__ == '__main__':
  main()

Solution (Python):
s=input()
n=len(s)
if n==2:
    if s[0]==s[1]:
        print(1,2)
    else:
        print(-1,-1)
else:
    s='!!'+s
    f=False
    for i in range(n):
        if s[i]==s[i+2] or s[i+1]==s[i+2]:
            f=True
            print(i-1,i+1)
            break
    if not f:
        print(-1,-1)

Solution (Python):
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s = str(readline().rstrip().decode('utf-8'))
    if len(s) == 2:
        if s[0] == s[1]:
            print(1, 2)
        else:
            print(-1, -1)
    else:
        q = collections.deque(list(s[:2]))
        c = collections.Counter(q)
        for i in range(2, len(s)):
            q.append(s[i])
            c = collections.Counter(q)
            if len(c) <= 2:
                print(i - 2 + 1, i + 1)
                exit()
            q.popleft()
        print(-1, - 1)


if __name__ == '__main__':
    solve()

Solution (Python):
import sys

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  


S = list(rs())
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):
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s = str(readline().rstrip().decode('utf-8'))
    if len(s) == 2 and s[0] == s[1]:
        print(1, 2)
    else:
        for i in range(2, len(s)):
            ts = collections.Counter(s[i-2:i+1]).most_common()[0]
            if ts[1] == 2:
                print(i-1, i+1)
                exit()
        print(-1, -1)


if __name__ == '__main__':
    solve()

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

Solution (Python):
S = input()

if len(S) == 2:
  if S[0] == S[1]:
    print('1 2')
    exit()
else:
  for i in range(len(S)-2):
    if any([S[i:i+3].count(S[j]) >= 2 for j in range(i,i+3)]):
      print(i+1,i+3)
      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()
  elif i <= len(s)-3:
    if s[i] == s[i+2]:
      print(i+1,i+3)
      exit()
print(-1,-1)

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

Solution (Python):
import sys
readline = sys.stdin.readline
s = [-1, -2] + list(map(ord, readline().strip()))
N = len(s)
ans = (-1, -1)
for i in range(2, N):
    if s[i] == s[i-1]:
        ans = (i-2, i-1)
        break
    if s[i] == s[i-2]:
        ans = (i-3, i-1)
        break
print(*ans)

Solution (Python):

import sys


def solve(s: str):
    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):
        ss = s[i:i+3]
        if ss[0] == ss[1] or ss[1]==ss[2] or ss[2] == ss[0]:
            print(i+1,i+3)
            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):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s = str(readline().rstrip().decode('utf-8'))
    if len(s) == 2:
        if s[0] == s[1]:
            print(1, 2)
        else:
            print(-1, -1)
    else:
        for i in range(len(s)-2):
            ts = s[i:i+3]
            if ts[0] == ts[1] or ts[1] == ts[2] or ts[0] == ts[2]:
                print(i+1, i + 3)
                exit()
        print(-1, -1)


if __name__ == '__main__':
    solve()

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

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

print(-1,-1)

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

Solution (Python):
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors







def nu(x):
    return ord(x)-ord('a')
s=input()

if(s[0]==s[1]):
    print(1,2)
    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 fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt

from sys import exit

from copy import deepcopy
import numpy as np

import bisect
import re
import heapq


ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    s = input()
    n = len(s)
    for i in range(n-2):
        if s[i] == s[i+1]:
            ans = str(i+1) + ' ' + str(i+2)
            print(ans)
            exit()
        if s[i] == s[i+2]:
            ans = str(i+1) + ' ' + str(i+3)
            print(ans)
            exit()

    if s[n-2] == s[n-1]:
        ans = str(n-1) + ' ' + str(n)
        print(ans)
        exit()
    
    print('-1 -1')








main()

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 len(set(S[i:i+3])) == 3:
        pass
    else:
        print(i+1, i+3)
        exit()

print(-1, -1)

Solution (Python):
def main():
    S = input()

    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            print(str(i+1) + ' ' + str(i+2))
            exit()
    
    for i in range(len(S)-2):
        if S[i] == S[i+2]:
            print(str(i+1) + ' ' + str(i+3))
            exit()

    print('-1 -1')



if __name__ == "__main__":
    main()

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):
import sys
input = sys.stdin.readline

def main():
    s = input().strip()

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

if __name__ == "__main__":
    main()

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

if res == -1:
    print("-1 -1")
elif leng == 2:
    print(str(res)+" "+str(res+1))
else:
    print(str(res)+" "+str(res+2))

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

def main():
    s = input().strip()

    
    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)

if __name__ == '__main__':
    main()

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

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

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

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

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

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

print(A,B)

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

Solution (Python):
import sys
import os
S = input()
lenght = len(S)
flg = 0
if lenght == 2 and S[0] == S[1]:
    print(1,2)
    sys.exit()

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

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

ans = [-1,-1]
for i in range(N):
  if(i != 0):
    if(s[i-1]==s[i]): 
      ans = [i,i+1]
      break
  if(i >= 2):
    if(s[i-2]==s[i]):
      ans = [i-1,i+1]
      break
      
print(ans[0],ans[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(len(s)-1):
  if s[i] == s[i+1]:
    print(i+1, i+2)
    break
  if i < len(s) - 2:
    if s[i] == s[i+2]:
      print(i+1, i+3)
      break
  if i == len(s) - 2:
    print(-1, -1)

Solution (Python):
from collections import defaultdict
s = list(input())
d = defaultdict(list)

for i in range(len(s)):
    if d[s[i]]:
        ld = i - d[s[i]][-1]
        if ld <= 2:
            print(i - ld + 1, i + 1)
            break
    d[s[i]].append(i)
else: print(-1, -1)

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

left = -2
right = -2

for i in range(max(1, len(S)-2)):
    if S[i] == S[i+1]:
        left = i
        right = i+1
        break
    if len(S) == 2:
        break
    if S[i] == S[i+2]:
        left = i
        right = i+2
        break
    if S[i+1] == S[i+2]:
        left = i+1
        right = i+2
        break

print(left+1, right+1)

Solution (Python):
s=input()

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

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

if f:print(-1,-1)

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

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

    if len(s) == 2:
        print("-1 -1")
        exit(0)

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

if __name__ == '__main__':
    main()

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):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
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)]
mod = 1000000007



s = S()
for i in range(len(s) - 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
    elif s[i + 1] == s[i + 2]:
        print(i + 2, i + 3)
        break
else:
    if len(s) == 2 and s[0] == s[1]:
        print(1, 2)
    else:
        print(-1, -1)

Solution (Python):
import sys
import heapq
import bisect

mod = 10**9+7
dd = ((-1,0),(1,0),(0,-1),(0,1))

def I(): return(int(sys.stdin.readline()))
def LI(): return([int(x) for x in sys.stdin.readline().split()])
def S(): return(list(sys.stdin.readline())[:-1])
def IR(n): return([I() for _ in range(n)])

def GCD(a,b):
    while b!=0:
        a,b = b,a%b
    return a

def LCM(a,b):
    return a * b // GCD(a,b)

def Eratosthenes(N):
    r = [True]*(N+1)
    r[0] = False
    r[1] = False
    i = 2
    while i*i<=N:
        if r[i]: 
            j = i
            while i*j<=N:
                prime[i*j]=False
                j+=1
        i+=1
    return(r)

def main():
    s = S()
    N = len(s)
    for i in range(N-1):
        if s[i] == s[i+1]:
            return(" ".join(map(str,[i+1,i+2])))
    for i in range(N-2):
        if s[i] == s[i+2]:
            return(" ".join(map(str,[i+1,i+3])))
    return(" ".join(map(str,[-1,-1])))

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

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