def isLessLexo(strr,s):
    return min(strr,s)
def main():
    no = int(input())
    s = input()
    iind,jind = 0,0
    for i in range(no):
        for j in range(i+1,no+1):
            temp = s[:i]+s[i:j][::-1]+s[j:]
            if len(temp) == no:
                if isLessLexo(temp,s) == temp:
                    print("YES")
                    print(i+1,j+1)
                    return
    print("NO")
    return 
main()