This has the same time and memory complexity as the original, and lost,
version. It does use twice the memory needed for the buffer.
TODO: reduce the size of the buffer to half of what it is now.
TODO: add some more tests. Pay attention to odd/even sized strings in
combination. Add some string that are closer to being the same with some
weird mix of pre, post and infix strings.
TODO: See if it's possible to make this faster by divide-and-conquer
TODO: See if it's possible to use SIMD instructions to improve
performance.