Approach hintTry it first, then revealHide
The lexicographically largest subsequence is the chain of suffix maxima, which a monotonic stack finds. Repeating the operation effectively reverses those positions; check whether that makes the string sorted, and count moves ignoring the leading copies of the largest letter.