Hacker News new | ask | show | jobs
by bauble 924 days ago
I think the issue is that they tried to separate the input into a list of tokens, like ["5", "nine"], and work from there, which doesn't work on something like "oneight".
3 comments

I didn't have that issue at all; I just looped through the 20 different tokens and found first and last instances of all of them, and compared the very first and very last of all instances.

https://github.com/xdavidliu/advent-of-code/blob/main/2023/d...

But a simple replace if you do it like this .Replace("one", "on1e") or .Replace("eight", "eig8ht")

Not elegant but still do the job.

It's funny how all of us used the `oneight` as the edge case to test our code on...
I used "eightwo"