n=int(input())
s=input()
l=[]
for c in s:l.append(c)
l.sort()
if ''.join(l)==s:print('NO');exit()
c=t=0
for i in range(n):
    for j in range(i+2,n+1):
        r=s[:i]+s[i:j][::-1]+s[j:]
        if r>s:c=1;t=j
    if c==1:print('YES');print(i,t);break