n = int(input())
s = input()

def solve(n, s):
    if all(s[i]>=s[i-1] for i in range(1,n)):
        return [-1, -1]

    mi = n-1
    for i in range(n-1, -1, -1):
        if s[i] > s[mi]:
            return [i+1, mi+1]
        else:
            mi = i

res = solve(n, s)
if res == [-1, -1]:
    print('NO')
else:
    print('YES')
    print(' '.join(map(str, res)))