#include <bits/stdc++.h>
using namespace std;
const int md = (int)1e9 + 7;
const int siz = 300005;
long long arr[siz];
long long n, m, k, l;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  cin >> s;
  map<char, int> m;
  for (int i = n - 1; i >= 0; i--) {
    if (!m[s[i]]) {
      m[s[i]] = i + 1;
    }
  }
  int sm = 0;
  for (auto x : m) {
    if (sm < x.second)
      sm = x.second;
    else {
      cout << "YES" << '\n' << sm << " " << x.second;
      return 0;
    }
  }
  cout << "NO";
}
