Let's compress it. A. Next we get AC, which is not in the string table. The search through the string table can be computationally intensive, and some hashing is well worth the effort. There are several ways of dealing with this problem, and GIF implements a very clever one, but we'll get to that. This fact suggests an efficient method for storing strings in the table.
Decompression is perhaps more difficult conceptually, but it is really easier to program.
This table comes from what knowledge we have about the charstream that we will eventually get, like what possible values the characters can take. In GIF files, this information is in the header as the number of possible pixel values. The beauty of LZW, though, is that this is all we need to know. We will build the rest of the string table as we decompress the codestream. The compression is done in such a way that we will never encounter a code in the codestream that we can't translate into a string.