C++ using <iostream> and <cstring> only
Part A. [2 marks]
Part 1: Header Encoding
Write a program that reads a line of printable characters and encodes it with a sequence of keys, where each key is a binary string of '0's and '1's. The sequence of keys starts with a key of length 1, followed by three keys of length 2, seven keys of length 3, fifteen keys of length 4, etc. The keys of the same length are in sequence of their binary value, but not all '1's.
The encoding scheme is as follows:
Assume the input header is: n(X+# $9o""? ..
( 00
x 01
+ # $ 9 0 10 000 001 010 011 100 101
? 0000
Key string:
0
110
To verify the correctness of the encoding, write a function to read in a character and print the key(s) of that character.
Notes:
1. You may not know the length of the header in advance.
2. The maximum length of the key string is seven. That is, the longest key string is "1111110". Hint: A character string should have a