s = next input character;
while not EOF
{
c = next input character;
if s + c exists in the dictionary
s = s + c;
else
output the code for s;
add string s + c to the dictionary with a new code;
s = c;
}
output the code for s;