Programming Contest
Problem A  Two-Bit Encryption

A new form of encryption is being tried out.  It takes an ordinary text message and encrypts it one line at a time, in groups of four bytes by extracting two bits from each of the four bytes.  The two-bit pairs are assembled in a different pattern to form four encrypted bytes.  Before the encryption is performed, one byte containing the number of characters read from the line is prepended to the line of characters.  Also, zero or more junk bytes are appended to the line in order to ensure that the line contains a multiple of 4 characters, including the length byte and all read characters.  The length byte does not count these junk bytes or itself.  Here is an example:

Confidential, not for public viewing:
This is a trial run for the encryption of messages
using the 2-bit method.

The first line contains 37 characters, including spaces; the length and first 3 characters are encrypted as follows:
     37                C              o               n
00100101  01000011  01101111  01101110

The first encrypted byte is formed from the first two bits of the first byte, the second two bits of the second byte, the third two bits of the third byte, and the last two bits of the fourth byte.  The underlined bits form the encrypted byte.

00100101  01000011  01101111  01101110        to give   00001110

Then, the first two bits of the second byte, the second two bits of the third byte, the third two bits of the fourth byte and the last two bits of the first byte form the second encrypted byte.

00100101  01000011  01101111  01101110        to give     01101101

Then, the first two bits of the third byte, the second two bits of the fourth byte, the third two bits of the first byte, and the last two bits of the second byte form the third encrypted byte.

00100101  01000011  01101111  01101110        to give     01100111

And finally, the first two bits of the fourth byte, the second two bits of the first byte, the third two bits of the second byte, and the last two bits of the third byte form the fourth encrypted byte.

00100101  01000011  01101111  01101110        to give     01100011

The next four bytes of the original message, "fide" are encrypted in a similar way; and so on with the other message characters.  The last grouping of four bytes will contain only two message characters and two junk characters to fill out the group of four.  The encrypted lines from above would look like this if displayed by NotePad:

mgcefehybleb,,lrg,dpc>`mifpe;`bzmgey7f(
j`tk#pq d1``nay6|ba.`rg9d`d/`afpvqxlak.ao.dqqgc`{ug
1{eW`f?db`9$(e~a$dqmflk,

The first character of a line is often not displayable; Visual Studio displays the first characters as musical notes and a down arrow for lines 1 and 2. The encrypted message has been written into a text file; your program should prompt for the file name. A file named minisecret.txt contains the three-line message above.  Your program should decrypt the message in the file and display it on the screen, exactly as it appeared originally.