n = int(input())
s = input()
si = sorted(s)
indexs = -1
indexf = -1
for i in range(len(s)):
	if s[i]!=si[0]:
		indexs = i
		break
# print(indexs)
for i in range(indexs,len(s)):
	if s[i] == si[0]:
		indexf = i
		break
# print(indexf)
# print(si)

ans = ""
if indexf == -1 or indexs == -1:
	print("NO")
else:
	res = ""
	resrev = ""
	for i in range(0,indexs):
		res += s[i]
	for i in range(indexs,indexf+1):
		resrev += s[i]
	resrev = "".join(reversed(resrev))
	for i in resrev:
		res += i
	for i in range(indexf,len(s)):
		res += s[i]


	print("YES")
	print("{} {}".format(indexs+1, indexf+1))