n = int(input())
s = input()
st = "".join(sorted(s))
if st==s:
    print("NO")

else:
    begin=0
    end = 0
    for i in range(n):
        if s[i]>st[i]:
            begin=i+1
        elif begin!=0 and s[i]<s[begin-1]:
            end = i+1
            break
    print("YES")
    print(begin,end)