#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  string ss = s;
  sort(ss.begin(), ss.end());
  if (ss.compare(s) == 0) {
    cout << "NO" << endl;
  } else {
    int l, r;
    for (int i = 0; i < n; ++i) {
      if (ss[i] < s[i]) {
        l = i;
        while (ss[i] <= s[i]) {
          r = i;
          i++;
        }
        break;
      }
    }
    cout << "YES" << endl;
    if (l == r) r++;
    cout << l + 1 << " " << r + 1;
  }
}
