n = int(input())
S = list(input())
T = sorted(S)
if S == T:
    print('NO')
else:
    for i in range(n):
        if T[i] != S[i]:
            start = i
            break
    for i in range(start+1,n):
        if S[start] > S[i]:
            break
    print('YES')
    print(start+1,i+1)
    
