def printAns(ans,l,r):
    print(ans)
    print(l,r)

def main():
    n = int(input())
    str1 = input()

    is_lexi_sorted = True
    l=0
    r=0
    for i in range(n-1):
        if str1[i] >str1[i+1]:
            is_lexi_sorted = False
            l=i
            break

    if is_lexi_sorted:
        print('NO')
    else:
        #find l and r

        for i in range(l,n-1):
            if str1[i] > str1[i+1]:
                r = i
                break
        printAns('YES',l+1,r+1)

main()
