#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (auto u : v) {
    os << u;
    if (u != *v.rbegin()) os << ",";
  }
  os << "]" << endl;
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& second) {
  os << "{";
  for (auto u : second) {
    os << u;
    if (u != *second.rbegin()) os << ",";
  }
  os << "}" << endl;
  return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "{";
  os << p.first << "," << p.second;
  os << "}" << endl;
  return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& make_pair) {
  for (auto p : make_pair) os << p.first << " : " << p.second << endl;
  return os;
}
inline long long max(long long a, long long b) { return a > b ? a : b; }
inline long long min(long long a, long long b) { return a < b ? a : b; }
void boost() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int32_t main() {
  boost();
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    string second;
    cin >> second;
    string tp = second;
    long long first[26];
    long long last[26];
    memset(first, -1, sizeof(first));
    memset(last, -1, sizeof(last));
    sort(tp.begin(), tp.end());
    if (tp == second)
      cout << "NO" << endl;
    else {
      bool vis[26];
      for (long long i = 0; i < n; i++) {
        if (!vis[second[i] - 'a']) {
          first[second[i] - 'a'] = i;
        }
        vis[second[i] - 'a'] = true;
      }
      memset(vis, false, sizeof(vis));
      for (long long i = n - 1; i >= 0; i--) {
        if (!vis[second[i] - 'a']) {
          last[second[i] - 'a'] = i;
        }
        vis[second[i] - 'a'] = true;
      }
      for (long long i = 1; i < n; i++) {
        if (vis[tp[i] - 'a']) {
          if (first[tp[i] - 'a'] < last[tp[i - 1] - 'a'] &&
              tp[i] != tp[i - 1]) {
            cout << "YES" << endl;
            cout << first[tp[i] - 'a'] + 1 << " " << last[tp[i - 1] - 'a'] + 1
                 << endl;
            return 0;
          }
        }
      }
      cout << "NO" << endl;
    }
  }
  return 0;
}
