n = int(input())
string = input()
start = -1
end = -1
for i in range(n - 1):
    if ord(string[i]) <= ord(string[i+1]):
        continue
    else:
        start = i
        for j in range(start + 1, n):
            if ord(string[j]) < ord(string[start]):
                end = j
                break
        break
if start == -1 or end == -1:
    print("NO")
else:
    print("YES")
    print(start + 1, end + 1)
