#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = 1LL << 62;
const long long mx = 100005;
const double eps = 1e-10;
long long dx[10] = {1, 0, -1, 0};
long long dy[10] = {0, -1, 0, 1};
long long power(long long a, long long b) {
  if (b == 0) return 1;
  long long x = power(a, b / 2);
  x = x * x;
  if (b % 2) x = x * a;
  return x;
}
int main() {
  long long tst, a, b, c, k, n, m, res = 0, ans = 0, t = 0;
  scanf("%lld", &n);
  string str;
  cin >> str;
  string arr = str;
  sort(arr.begin(), arr.end());
  unordered_map<char, long long> mm;
  for (long long i = 0; i < (long long)(str).size(); i++) {
    mm[str[i]] = i + 1;
  }
  if ((long long)(mm).size() == 1) {
    cout << "YES"
         << "\n";
    cout << 1 << " " << n << "\n";
  } else if (arr == str) {
    printf("NO\n");
  } else {
    cout << "YES"
         << "\n";
    cout << mm[arr[n - 1]] << " " << mm[arr[0]] << "\n";
  }
  return 0;
}
