# bugado
def binSearch(it, obj, ini=0, end=-1):
  if end == -1:
    end = len(it)-1
  mid = (ini+end)//2
  while ini <= end and it[mid] != obj:
    print("ini end", ini, end)
    mid = (ini+end)//2
    if obj > it[mid]:
      ini = mid+1
    else:
      end = mid
  return (mid, it[mid])

def binGreaterSearch(it, obj, ini=0, end=-1):
  print("end val -> ", end)
  if end == -1:
    end = len(it)-1
  print("end val -> ", end)
  mid = (ini+end)//2
  while ini <= end and it[mid] <= obj:
    print("ini end", ini, end)
    mid = (ini+end)//2
    if obj <= it[mid]:
      ini = mid+1
    else:
      end = mid
  return (mid, it[mid])


# t=[1, 2, 6, 9, 11, 101, 290]

# binGreaterSearch(t, 101)



def main():
  n = int(input())

  s  = input()
  s_sort  = ''.join(sorted(s))
  if s_sort == s:
      print("NO")
  else:
      print("YES")
      for i in range(len(s)):
          si, soi = s[i] , s_sort
          if si != soi:
            s = s[::-1]
            for idx in range(len(s)):
              if s[idx] > si:
                print( f"{i} {len(s) - 1 - idx}" )
                return 0

if __name__ == '__main__':
  main()