Lossy Compressor

A string of text--a sentence, for example--can be reduced in size by eliminating some of the letters. Because the new string takes less space, this is an example of "compression." And because the text may be a little harder to understand--in fact some key letters may have been removed--the compression is called "lossy": we have lost some amount of data.

Write a program lossy_compressor.py that has a function called compress(string). That function takes as a parameter a string of words and converts them to a new "lossy" string that includes only:

  1. the first letter of each word, and
  2. the consonants in the word

Spaces between words are maintained, but vowels in a word (if they aren't the first letter in the word) are eliminated. The resulting lossy string is returned by the function.

The main program should take a few strings, call the function on them to perform the compression, and then perform a comparison of the two strings, including a calculation of how much the string has been compressed.

Sample Output

The original string is "Thank you for the birthday gift--I love it!"
The compressed string is "Thnk y fr th brthdy gft--I lv it!"
The original string was 43 characters long.
The compressed string is 33 characters long.
The compression was 23.3 %.