n = int(input())
s1 = input()
arr = list(s1)
sorted_arr = sorted(arr)
s2 = "".join(sorted_arr)

if s1 == s2:
    print("NO")
else:
    i = 0
    while(i < n - 1 and arr[i] == sorted_arr[i]): 
        i = i + 1
    j = n - 1
    while(j >= 0 and arr[j] == sorted_arr[j]):
        j = j - 1
    print("YES")
    print("%d %d" % ((i + 1), (j + 1)))