#include <bits/stdc++.h>
using namespace std;
const int maxn = 300005;
int mn[maxn];
int main() {
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  mn[n - 1] = s[n - 1];
  for (int i = n - 2; i >= 0; i--) mn[i] = min(mn[i + 1], (int)s[i]);
  int mark = -1;
  for (int i = 0; i < n; i++) {
    if (s[i] > mn[i]) {
      mark = i;
      break;
    }
  }
  if (mark == -1) {
    puts("NO");
    return 0;
  }
  int p = mn[mark];
  int ans;
  for (int i = mark; i < n; i++)
    if (s[i] == p) ans = i;
  puts("YES");
  cout << mark + 1 << ' ' << ans + 1 << endl;
}
