#!/usr/bin/env python
# coding: utf-8

# In[1]:


n = int(input())
s = input()
l = 0
r = 0
flag = 1
minin = 0
maxin = 0
for i in range(len(s)-1):
    if(s[i] <= s[i+1]):
        flag = 0
    else:
        flag = 1
if(flag == 0):
    print("NO")
else:
    l = 0
    r = len(s)-1
    while(l < r):
        if(s[l] > s[r]):
            minin = l+1
            maxin = r+1
            break
        else:
            if(s[r-1] < s[r]):
                r -= 1
                continue
            if(s[l+1] > s[l]):
                l += 1
                continue
    print("YES")
    print(minin , end = " ")
    print(maxin , end = " ")


# In[ ]:




