function Main(input) {
  const data = input.trim();
  const strs = data.split("");
  var result = "-1 -1";

  for (var i = 0; i < strs.length; i++) {
    if (strs[i] === strs[i + 2]) {
      result = `${i + 1} ${i + 3}`;
      break;
    } else if (strs[i] === strs[i + 1]) {
      result = `${i + 1} ${i + 2}`;
      break;
    }
  }
  console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
