#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, r = 0, l, d, p = 0;
  cin >> n;
  char c[n], t[n];
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    t[i] = c[i];
  }
  sort(c, c + n);
  int i;
  l = 1;
  k = n - 2;
  for (i = 0; i < n; i++) {
    if (c[i] <= c[0]) l = i + 1;
    if (c[i] >= c[n - 1]) k = i;
    if (c[i] > t[i]) break;
  }
  if (i == n)
    cout << "NO";
  else {
    cout << "YES" << endl;
    cout << l << " " << k << endl;
  }
}
