So, I've already done the translation and the substitution of the source music. I'm with a string of all of the numbers and symbols already changed into they respective ones.
I've been able to use this string and by using a for loop to get each element and some if else statements. It was all good, however when two letters are equal but one of them is a sharp or flat, it doesn't return the correct value.
The if else are the follow: I separed into two section. When the element is equal to # or b and when the element is not equal to any of these.
When the element is equal to any of these, i'm adding a one to a counter n, if the previous element and the next is different, then, i'm going to add the previous elements, which is going to be the letter, the element itself, wheter a # or a b and the counter itself. After that, I zero the counter.
When the element is not equal to # or b, i'm going to add to another counter +1, if the next element is different then the present element and is not a # or a b, then i'm going to add to the final string the present element and the counter. After that I zero the counter.
However the Result(the first line is the base string, the second my result, the third the solution for this test). I don't know why the blue section is different and don't have a idea on how to solve it using the if else statements.
Thank if you can help me!