import std.stdio, std.string,std.range, std.conv, std.array, std.algorithm, std.math, std.typecons, std.functional, std.bigint, std.random;

class Data {
  int start, end;
  int count;
}

void main() {
  auto S = readln.chomp;
  Data[char] data;
  foreach (i, s; S) {
    auto p = s in data;
    if (p) {
      auto d = data[s];
      d.count++;
      d.end = cast(int)i;
    } else {
      Data d = new Data;
      d.start = d.end = cast(int)i;
      d.count = 1;
      data[s] = d;
    }
  }
  foreach (s,d; data) {
    if (d.start < d.end && d.count * 2 >= d.end-d.start+1) {
      writeln(d.start+1, " ", d.end+1);
      return;
    }
  }
  writeln("-1 -1");
}
