t=int(input())
s=input()
a=''.join(sorted(s))
if s==a:
    print("N0")
else:
    l=0 
    r=0
    for i in range(t):
        if s[i]!=a[i]:
            l=i
            r=s[i:].index(a[i])
            break
    print("YES")
    print(l+1,end=" ")
    print(r+i+1)
    