#num = list(map(int,input().split()))
#n,m=map(int,input().split())
n = int(input())
s = input()
def calc(s):
    val = ord(s[-1])
    an = n
    for i in range(n-1,-1,-1):
        if ord(s[i])>val:
            return (i+1,an)
        else:
            val = ord(s[i])
            an = i+1
    return (-1,-1)
ans= calc(s)
if ans[0]==-1:
    print("NO")
else:
    print("YES")
    print(*ans)
    
