Ad
  • Default User Avatar

    I didn't notice the easy solution, which I think was better because it made up do more actual coding.

  • Default User Avatar

    Hey @MikeJH82 and welcome to Codewars - in general, saying that stuff "works on my machine" is covered in the Troubleshooting page , there are lots of reasons why something might seem to work locally but not on CW; the most common being that you haven't tried all possible test cases on your machine, only "basic" ones.

    I copied your code vs the tests and it seems that it is failing on inputs of this kind:

    s = "L iMiMiMiMiMi R"

    your code produces result = "L R" with 2 spaces, while expected answer is "L R" with only 1 space.

    Indeed the same thing happens with one of the examples from the description: "1i2 33 i4i5 i555ii5" for which your code returns "33 55" with 2 spaces (and here 2 5's also) rather than "33 5".

  • Default User Avatar

    For some reason the code I write to remove additional spaces is working in VSCode but not here.