// 0526.cpp : 定义控制台应用程序的入口点。
//
#ifndef ONLINE_JUDGE
#define _CRT_SECURE_NO_WARNINGS
#define gets(str) gets_s(str)
#endif

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <queue>
#define INF 999999
using namespace std;
struct PP
{
	char ch;
	int s, t, num;
}p[130];

bool operator < (PP a, PP b)
{
	return a.num>b.num;
}
int main()
{
	char s[100005];
	gets(s);
	for (int i = 0; i < strlen(s); i++)
	{
		if (p[s[i]].s==0) p[s[i]].s = i;
		p[s[i]].t = i;
		p[s[i]].num++;
	}
	sort(p, p + 128);
	for (int i = 0; i < 26; i++)
	{
		if (p[s[i]].num<2)
		{
			printf("-1 -1\n");
			break;
		}
		if (p[s[i]].num * 2>p[s[i]].t - p[s[i]].s + 1)
		{
			printf("%d %d\n", p[s[i]].s + 1, p[s[i]].t + 1);
			break;
		}
	}

#ifndef ONLINE_JUDGE
	printf("\n");
	system("pause");
#endif
	return 0;
}