 LZW is an LZ78-based algorithm that uses a dictionary pre-initialized with all possible characters (symbols) or emulation of a pre-initialized dictionary.The main improvement of LZW is that when a match is not found, the current input stream character is assumed to be the first character of an existing string in the dictionary (since the dictionary is initialized with all possible characters), so only the "last matching index" is output (which may be the pre-initialized dictionary index corresponding to the previous (or the initial) input character).Refer to the LZW article for implementation details.