I don't get the amount of effort people out into the replacement-strategy, I did perfectly fine without it and the code is about as complex as the examples I've seen.
https://github.com/codr7/swift-interpreter/blob/main/part10/...
https://github.com/codr7/swift-interpreter/blob/main/part10/...
https://gist.github.com/joedavis/3d6f2b87bae4809ef8a062caff7...
C++'s .rbegin() / .rend() reverse iterators made the search fairly trivial.
My solution in Kotlin https://github.com/kolonialno/adventofcode/commit/686cbebb07...
Oh so THAT is what is causing people problems.