main=getLine>>=putStrLn.unwords.map show.(\s->f s 1)
 where f (a:b:c:d) i = if a==b then [i,i+1] else (if a==c then [i,i+2] else (f (b:c:d) (i+1)))
       f [a,b] i = if a==b then [i,i+1] else [-1,-1]