CSE 271: Programming Assignment 3

Assigned: 1 February
Due: 6 February

Abstract

Write a simple character filter to "compress" a text sequence.

Details

The program should convert sequences of three or more repeated characters (of all kinds, including special 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. While illustrative of compression, the above does not reflect actual end-of-line processing. The following is an actual transcript of running one solution interactively: Another valid example is the following, in which a different function for reading characters was used: In both cases the same set of input lines was provided, but because different system library functions were used, a different interactive output was generated. However, the same sequence of characters was generated to standard out in both cases.

Submission Requirements

  1. As usual, the program must be named p3.c and must reside in the cse271.131/p3 subdirectory.
  2. Create and use an appropriate Makefile that will compile your program using make, and will clean the directory with make clean.
  3. Your name must be in the comment section.
  4. Do a touch DONE when the program is ready to be collected.

Last revised: 30 January 2013.