#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int i = 0, j = n - 1, flag = 0;
  while (i != j) {
    if (s[i] > s[j]) {
      flag = 1;
      break;
    }
    if (s[i] < s[j])
      j--;
    else
      i++;
  }
  if (s[i] < s[i - 1]) {
    flag = 1;
    i = i - 1;
  }
  if (flag)
    cout << "YES" << endl << i + 1 << " " << j + 1;
  else
    cout << "NO";
}
