n = int(input())
a = input()
small = [0]*n
large = [0]*n
small[-1] = a[-1]
large [0] = a[0]
for i in range(n-2,-1,-1):
    small[i] = min(a[i],small[i+1],key = ord)
for i in range(1,n):
    large[i] = max(large[i-1],a[i])
for i in range(n):
    if ord(small[i])<ord(large[i]):
        print("YES")
        print(large.index(large[i])+1,small.index(small[i],i+1)+1)
        break
else:
    print("NO")
