Run length encoding is a compression technique that takes advantage of repeated consecutive digits. Encoding involves putting a character followed by count.
Example input: 123334455555AAA
Output for above input: 1\12\13\34\25\5A\3
(1 is appearing once, 2 is appearing twice,k 3 is appearing 3 times, 4 is appearing twice, 5 is appearing 5 times, A is appearing 3 times. \ represents the ESCAPE sequence. \1 means ASCII value 1)
If a digit is repeated more than 255 times, it should be split into two parts as in following example:
Example input:1 repated 257 times
Output for above input:1\2551\2
A decoder does the reverse.
Write a C program that encodes in RLE format and also decodes RLE format to restore to the original file. (When a file is encoded and decoded, the original file should be restored)