LZ77 implementation in C++