n = int(input())
s = input()
l = 0
r = 0
chk = False
for i in range(n-1):
    if s[i] > s[i+1] and not chk:
        chk = True
        l = i
        r = i+1
    elif s[i] > s[i+1] and chk:
        r += 1
if chk:
    print('YES')
    print('%d %d'%(l+1,r+1))
else:
    print('NO')
