#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s;
  t = s;
  sort(t.begin(), t.end());
  if (t == s) {
    cout << "NO";
  } else {
    cout << "YES" << endl;
    int i = 0;
    while (i < s.size()) {
      if (t[i] != s[i]) {
        break;
      }
      i++;
    }
    int j = i;
    while (true) {
      if (s[j] == t[i]) {
        break;
      }
      j++;
    }
    cout << i << ' ' << j;
  }
  return 0;
}
