My solution was worse than most: replace one -> one1one
You are only going to do the replace all for each number and if the “e” is also in eight it is still there for the next set of replace.
A better quick and dirty solution from Mastodon was to just add the common character first:
twone -> twoone
You can also use o1e as there are never more than a single shared character. It also doesn’t change the string size so it can be done in place. Still an ugly hack of a solution.
My solution was worse than most: replace one -> one1one You are only going to do the replace all for each number and if the “e” is also in eight it is still there for the next set of replace.
A better quick and dirty solution from Mastodon was to just add the common character first: twone -> twoone
I just check every substring haha
The problem is that 21 is not the only problematic combination.
You can also use o1e as there are never more than a single shared character. It also doesn’t change the string size so it can be done in place. Still an ugly hack of a solution.