#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline int read();
const int M = 500016, MOD = 1000000007;
char save[M];
int main(void) {
  int n = read();
  scanf("%s", save);
  for (int i = 0; i < n - 1; ++i) {
    if (save[i] > save[i + 1]) {
      printf("%d %d\n", i, i + 1);
      return 0;
    }
  }
  printf("NO\n");
  return 0;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
