import java.util.*;
import java.io.*;
/**
 *
 * @author alanl
 */
public class Main{
    static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static void main(String[] args) throws IOException{
        int n = readInt();
        char[]arr = readLine().toCharArray();
        String s = new String(arr);
        char[]pre = new char[n], suf = new char[n];
        pre[0] = arr[0];
        suf[n-1] = arr[n-1];
        for(int i = 1; i<n; i++){
            pre[i] = (char)(Math.max(pre[i-1], arr[i]));
        }
        for(int i = n-2; i>=0; i--){
            suf[i] = (char)(Math.min(suf[i+1], arr[i]));
        }
        for(int i = 0; i<n/2; i++){
            if(suf[n-1-i]<pre[i]){
                println("YES");
                println((i+1)+" "+(n-i));
                return;
            }
        }
        println("NO");
    }
    static String next () throws IOException {
        while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(input.readLine().trim());
        return st.nextToken();
    }
    static long readLong () throws IOException {
        return Long.parseLong(next());
    }
    static int readInt () throws IOException {
        return Integer.parseInt(next());
    }
    static double readDouble () throws IOException {
        return Double.parseDouble(next());
    }
    static char readChar () throws IOException {
        return next().charAt(0);
    }
    static String readLine () throws IOException {
        return input.readLine().trim();
    }
    static void print(Object b) {
        System.out.print(b);
    }
    static void println(Object b) {
        System.out.println(b);
    }
    static void println() {
        System.out.println();
    }
}
