#include<bits/stdc++.h>
#define ll long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;
string s;
signed main(){
	ios_base::sync_with_stdio(0);
	cin>>s;
	for(int i=0;i+2<sz(s);i++){
		if(s[i]==s[i+1]||s[i]==s[i+2]||s[i+1]==s[i+2]){
			cout<<i+1<<' '<<i+3;
			re 0;
		}
	}
	if(sz(s)==2&&s[0]==s[1]) cout<<"1 2";
	else cout<<"-1 -1";
	re 0;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s; cin >> s;
  int n = s.size();
  for(int i = 0; i < n; i++){
    if(i < n-1 && s[i] == s[i+1]){
      cout << i+1 << " " << i+2 << endl;
      return 0;
    }else if(i < n-2 && s[i] == s[i+2]){
      cout << i+1 << " " << i+3 << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;
  return 0;
}