run length encoding and decoding