Sponsored
Use these hints if you're stuck. Try solving on your own first.
Find the next permutation of the given string k times.
Try to move each element to its correct position and calculate the number of steps.
Solve with full IDE support and test cases