Minimum Number of Operations to Make String Sorted

Hard

📝 Description

Calculate operations needed to make string sorted (mod 10^9+7)

Input Format

String s

Output Format

Number of operations

Constraints

1 ≤ s.length ≤ 3000

🔍 Sample Input

"cba"
            

✅ Sample Output

5
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run