News for hackers. Stuff that matters.
Re:Advent of Code 2023 is nigh by bradley13 on Friday December 01, 2023 @11:11AM (#38488352)
Seems to me that people made part 2 harder than it us. Just define an array containing the digits: "one", "two", and so forth. Then check for substring matches, position by position. Maybe not elegant, but effective.
Re:Advent of Code 2023 is nigh by bauble on Friday December 01, 2023 @12:22PM (#38489342)
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".
Re:Advent of Code 2023 is nigh by kemyke on Friday December 01, 2023 @03:36PM (#38491988)
But a simple replace if you do it like this .Replace("one", "on1e") or .Replace("eight", "eig8ht")

Not elegant but still do the job.

Re:Advent of Code 2023 is nigh by Maxion on Friday December 01, 2023 @02:35PM (#38491155)
It's funny how all of us used the `oneight` as the edge case to test our code on...
Re:Advent of Code 2023 is nigh by jes5199 on Friday December 01, 2023 @05:19PM (#38493298)
I used "eightwo"
Re:Advent of Code 2023 is nigh by xdavidliu on Sunday December 03, 2023 @08:14AM (#38506820)
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...

Re:Advent of Code 2023 is nigh by Vingdoloras on Friday December 01, 2023 @06:37PM (#38494115)
I just placed digits in the middle of the words instead of replacing them. This way I didn't "break" any overlapping words, and the order of digits is still the same.