n = int(input())
s = input()
t = sorted(s)
flag = False
for i in range(n):
    if s[i] != t[i]:
        flag = True
        break
if flag == False:
    print('NO')
else:
    print('YES')
    for j in range(i + 1, n):
        if s[j] < s[i]:
            print(i + 1, j + 1)
            break