"""
NTC here
"""
from sys import setcheckinterval,setrecursionlimit,stdout
setcheckinterval(1000)
setrecursionlimit(10**6)

iin=lambda :int(input())
lin=lambda :list(map(int,input().split()))
n=iin()
a=input()
a1=sorted(a)
l,r=0,0
for i in range(n):
    if a[i]!=a1[i]:l=i;break
else:
    print('NO')
    exit()
for i in range(l+1,n):
    if a[l]>a[i]:r=i;break
else:
    print('NO')
    exit()
#print(a,a1)
print('YES')
print(l+1,r+1)