Question: Write a program to implement a simplified LZ encoding algorithm for a single scan line containing 1024 integer values, with each value in the range from 0 to 255. The program should search for three-element patterns only, representing repeated RGB colors. Use integer codes for the patterns.