/*
    HARSHAD VAGHASIYA

        @DAIICT

          H_M_Vaghasiya

            */
#include<bits/stdc++.h>
using namespace std;
#define FS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define MAX_INT 100000
#define ld long double
#define pb push_back
#define mp make_pair
#define pu push
ll gcd(ll a,ll b){return __gcd(a,b);}
ll fact(ll n){ll s=1; for(ll i=1;i<=n;i++)s*=i; return s;}
ll pow1(ll n,ll k,ll mm){  if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow2(ll n,ll k,ll m){ll ans=1;
    while(k>0){if(k%2==1)ans=ans*n;
        n=n*n;k/=2;
    }return ans;
}
bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
	return a.first > b.first;
}
void solve(){
	FS;
    ll i,j,k,n,m,x,y,z;
    
}

int main(){
	ll i,j,k,n,m,x,y,z,q,p,r;
	cin>>n;
	string s;
	cin>>s;
	string t=s;
	sort(t.begin(),t.end());
	if(s==t){
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	char c=t[n-1];
	ll start=1,end=n;
	ll sf=0,ef=0;
	for(i=0;i<n;i++){
		if(s[i]==c && sf==0){
			start=i;
			sf=1;
		}
		else if(s[i]<c &&sf==1 && ef==0 ){
			end=i;
			ef=1;
			
		}
	}
	
	cout<<start+1<<" "<<end+1<<endl;
	return 0;
}

