LZW code implementation in C++