Amazon Interview Question

Given a decoder, design the encoder