Change Minimum Characters to Satisfy One of Three Conditions

Given two strings a and b, return the minimum number of characters you need to change in a to make it non-increasing.

Conditions:

Change all occurrences of a single character in a to any other character. Change all occurrences of multiple consecutive characters in a to any other set of consecutive characters. A string is non-increasing if for every two consecutive characters in the string, the first character is greater than or equal to the second character.

Ada AI

I want to discuss a solution

Help me solve this

Give more examples

What's wrong with my code?

How to use 'for loop' in javascript?