# Code compression

There is a ternary code of length 40 (i.e. $\mathbb{F}_3^{40}$) and all the $3^{40}$ codewords may be included in the message. If an error occurs one error can be corrected (with the help of the context). How can the message be compressed without information loss?