n = int(input())
s = input().rstrip()
ss = ''.join(sorted(s))
if s == ss:
  print('NO')
else:
  for j in range(n-1):
    if s[j]!=ss[j]:
      k = s[j+1:].index(ss[j])
      print('YES\n'+str(j+1)+' '+str(j+2+k))
      break

