n = int(input())
l = list(input())
cnt  = [0] * 26
cnt[ord(l[0]) - 97] = 1
st = -1
for i in range(1, n):
    cnt[ord(l[i]) - 97] = 1
    for j in range(ord(l[i]) - 97 + 1, 26):
        if cnt[j] == 1:
            st = i
if st == -1:
    print('NO')
    exit()
print('YES')
rev = -2
for i in range(st):
    if l[i] > l[st]:
        rev = i
        break
print(rev + 1, st + 1)