Abstract
Write a simple character filter to "compress" a text sequence.Details
The program should convert sequences of three or more repeated characters to a representation of the form ~nc where n is the number (a single digit) of repeated characters and c is the character. A single tilde (~) in the input should be output as a double tilde. A double tilde in the input should be output as ~~~~. Sequences of more than nine repeated characters must be broken up into two or more sequences of 9 or less.
io:~% gcc -Wall -o p2 p2.c io:~% ./p2 abbcddddeffgfff abbc~4deffg~3f a~bc55555 a~~bc~55 abbbbbbbbbbbbbbbbbbbc a~9b~9bbc ~~ ~~~~ ~~~~ ~4~ CTRL-D io:~%Submission Requirements
- As usual, the program must be named p2.c and must reside in the cse271.071/p2 subdirectory.
- Create and use an appropriate Makefile that will compile your program using make, and will clean the directory with make clean.
- Your name must be in the comment section.
- Do a touch DONE when the program is ready to be collected.