• dns@aussie.zone
    link
    fedilink
    arrow-up
    9
    ·
    edit-2
    1 year ago

    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

    • damium@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      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.