import sys
input=sys.stdin.readline
def main():
	n=int(input())
	s=input().strip()
	m=s[-1]
	at=n-1
	for i in range(n-2,-1,-1):
		if s[i] > m :
			print('YES')
			print(i+1,at+1)
			return
		m=s[i]
		at=i
	print('NO')
main()
