#include <bits/stdc++.h>

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

string s;

int main()
{
	cin >> s;
	for (int i = 0; i < s.size() - 1; i ++ )
		if (s[i] == s[i + 1])
		{
			cout << i + 1 << ' ' << i + 2 << endl;
			return 0;
		}
	
	for (int i = 0; i < s.size() - 2; i ++ )
		if (s[i] == s[i + 2])
		{
			cout << i + 1 << ' ' << i + 3 << endl;
			return 0;
		}
	
	puts("-1 -1");
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    string s;
    cin >> s;
    bool found = 0;
    int i, j;
    for (i = 0; i < (int)s.size() - 1; i++)
    {
        for (j = i + 1; j < (int)s.size(); j++)
        {
            if (s[i] == s[j])
            {
                if (2 > (j - i + 1) / 2)
                    found = 1;
                break;
            }
        }
        if (found)
            break;
    }
    if (found)
        cout << i + 1 << " " << j + 1 << endl;
    else
        cout << -1 << " " << -1 << endl;
}