Lets say I have 2 strings:
String1 = "ABBABBAA"
String2 = "ABBAABBB"
I want to turn String2 into String1. I can only change the string one at a time. My goal is that I want to figure out the number of times it will take me to change string2 into string1.
Also note that if two characters that need to be changed are next to eachother, count that as 1. Here is what I mean:
string1 = "GHGGH"
string2 = "HGGGH"
As you can see, I only need to change characters 1 and 2 in string2. Since characters 1 and 2 are next to eachother, I will count that as one turn. So the answer would be 1.
Now I will show you how to turn string2 into string1 from the example at the top:
String1 = "ABBABBAA"
String2 = "ABBAABBB"
In this example, You need to change string 5 and strings 7 and 8 in String2. The output would be 2, because one turn comes from 5, and the second turn comes from 7 and 8 since they are next to eachother.
Output:
>> 2
(Also I am a little new to Stack Overflow, so please excuse me if I may have written my question in bad formatting.)