#include <iostream>
#include <string>

int main()
{
    std::string s;
    std::cin >> s;

    int N = s.size();
    for(int i=0; i<N-1; i++){
        if(s[i] == s[i+1]){
            printf("%d %d\n", i+1, i+2); return 0;
        }
        else if(i != N-2 && s[i] == s[i+2]){
            printf("%d %d\n", i+1, i+3); return 0;
        }
    }
    printf("%d %d\n", -1, -1);
}