Compress and Decompress sentence using vowel based encryption cipher The aim is to parse a sentence and compress/encrypt it according to the rules below and then decrypt it using the key:


Remove all letters in a word before the first vowel is encountered. Example: pigeon becomes igeon.
All characters except alphabets should be kept in the sentence including numerals, punctuations, etc. Example: 200-storey building becomes 200-orey uilding.
Generate the shortest key array char[] = {a,b,x,&lt;your data&gt;} and write code to generate the original sentence using this key.


You need to write two functions: encrypt() and decrypt() which works for every sentence minimising the key-size.

Example 1:


  Input: The most technologically efficient machine man has ever
  invented is the book. -Northrop Frye-
  
  Output: e ost echnologically efficient achine an as ever invented is e
  ook. -orthrop e-
  
  Example key: {T,m,t,m,h,b,N,F,14,2,5}


Example 2:


  Input: "I need your clothes, your boots and your motorcycle. " - The
  T-800 in Terminator 2: Judgment Day
  
  Output: "I eed our othes, our oots and our otorcycle. " - e -800 in
  erminator 2: udgment ay
  
  Example key: {n,y,c,2,b,2,m,T,J,D,15}


Winning Criteria:


Write function encrypt() with input from stdin or file which generates output sentence and a key on stdout or file or memory.
Write function decrypt() with inputs the generated sentence and key from encrypt() and produces the original sentence.
This is code-golf so cumulative size of the two functions should be minimum. In case of tie-breaker, the generated key-size should be minimum.
Perl (126+67=193 characters)

Key contains each character removed along with its offset.

Encrypt reads one line from STDIN

Decrypt reads two: first the ciphered string then the key


sub encrypt{$_=&lt;&gt;;s(.)(++$j,$q|=$&amp;=~/[aeiou]/i,$q^=$&amp;eq$",!$q&amp;$&amp;=~/[a-z]/i&amp;&amp;(push@d,($&amp;,$j-1))||print$&amp;)ge;print$/.join',',@d}
sub decrypt{$q=&lt;&gt;,$_=&lt;&gt;;s/(.),(\d+)/substr($q,$2,0)=$1/gie;print$q}


Examples:

(encrypting)
The most technologically efficient machine man has ever invented is the book. -Northrop Frye-
&gt; e ost echnologically efficient achine an as ever invented is e ook. -orthrop e-
&gt; T,0,h,1,m,4,t,9,m,35,m,43,h,47,t,68,h,69,b,72,N,79,F,88,r,89,y,90

"I need your clothes, your boots and your motorcycle. " - The T-800 in Terminator 2: Judgment Day
&gt; "I eed our othes, our oots and our otorcycle. " - e -800 in erminator 2: Judgment ay
&gt; n,3,y,8,c,13,l,14,y,22,b,27,y,37,m,42,T,58,h,59,T,62,T,71,D,94

(decrypting)
e ost echnologically efficient achine an as ever invented is e ook. -orthrop e-
T,0,h,1,m,4,t,9,m,35,m,43,h,47,t,68,h,69,b,72,N,79,F,88,r,89,y,90
&gt; The most technologically efficient machine man has ever invented is the book. -Northrop Frye-

"I eed our othes, our oots and our otorcycle. " - e -800 in erminator 2: Judgment ay
n,3,y,8,c,13,l,14,y,22,b,27,y,37,m,42,T,58,h,59,T,62,T,71,D,94
&gt; "I need your clothes, your boots and your motorcycle. " - The T-800 in Terminator 2: Judgment Day


Ungolfed with comments


sub encrypt{
    # get input
    $_=&lt;&gt;;
    # for each character
    s(.)(
        # increment j
        ++$j,
        # set q to 1 if vowel
        $q |= $&amp;=~/[aeiou]/i,
        # set q to 0 if space
        $q ^= $&amp; eq $",
        # if q==0 and is a letter (consonant, because q=1 if vowel)
        !$q &amp; $&amp;=~/[a-z]/i &amp;&amp;
            # push both the letter and the offset to @d
            (push @d,($&amp;,$j-1))
        # otherwise print
        || print$&amp;
    )ge;
    # print a newline, then @d
    print$/.join',',@d
}
sub decrypt{
    # read a line to $q, and another to $_
    $q=&lt;&gt;,$_=&lt;&gt;;
    # for each [character],[number] in key
    s/(.),(\d+)/
        # add character back into string
        substr($q,$2,0)=$1
    /gie;
    # print deciphered string
    print$q
}