import java.util.*;
public class reverse_a_substring 
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		String s1="";
		char ch[]=s.toCharArray();
		char ch1[]=s.toCharArray();
		int temp1=0;
		int temp2=0;
		Arrays.sort(ch1);
		if(Arrays.equals(ch,ch1))
		{
			System.out.println("NO");
		}
		else 
		{
			int flag=0;
			int a[]=new int[26];
			for(int i=0;i<s.length();i++)
			{
				a[s.charAt(i)-'a']=i;
			}
			
			for(int i=0;i<a.length-1;i++)
			{
				for(int j=i+1;j<a.length;j++)
				{
					if(a[i]>a[j])
					{
						temp1=i;
						temp2=j;
						flag=1;
						break;
					}
				}
				if(flag==1)
					break;
			}
			System.out.println("YES");
			System.out.println(temp1+" "+temp2);
		}
	}
}
