Lecture 6.7 encode example