n = int(input())
s = input()
ss = sorted(s)

if ''.join(sorted(s)) == s:
	print('NO')
	exit()
i, j = 0, 0
for k in range(len(s)):
	if s[k] != ss[k]:
		i = k
		break
for k in range(i, len(s)):
	if s[k] < s[i]:
		j = k
		break

print('YES')
print(i+1, j+1)