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