n = int(input())
s = input()
poses = [-1] * 30
poses[ord(s[0]) - ord('a')] = 0
good = True
for i in range(1, len(s)):
    for j in range(ord(s[i]) - ord('a') + 1, 30):
        if poses[j] > -1:
            print('YES')
            print(poses[j] + 1, i + 1)
            good = False
            break
    poses[ord(s[i]) - ord('a')] = i
    if not(good):
        break
if good:
    print('NO')
