The main data structure of this program is a hash containing the valid successors of each character. The keys in the hash are characters and the values are strings consisting of all the characters that follow the key character in the text. These strings may contain duplicate characters. Start the program with reading the lines of the text from the keyboard. Store the lines in a single string variable. Make sure that there is a space between each pair of lines. Also put a space at the start and at the end of the text. Next, clean the text according to the requirements of exercise 4.3. Replace upper case by lower case and replace all sequences of characters outside of a-z by a single space. Collect the successors of each character in the text in a hash by converting the text to a character list (split on //) and looping through the list. For each character in the list ($list[$i]), append its successor ($list[$i+1]) to the hash value for that character. When the loop is finished, the hash should contain a sequence of valid successor characters for each character in the text. For example, for the input text " THis is a TEsT " the contents of $hash{"t"} will be "he " (note the space at the end). After this the program should ask the user for the expected length of the generated text. The final loop will generate the random text. Start with initializing the current character to a space. Next, select the next character by choosing a random number R based on the length of the successor string of the current character (in our example: length "t" is 3 so 0<=R<=2). Convert the successor string to a character list (split on //) and use the R-th character of the list as the next character. Store it in the current character variable, print it and repeat the random character selection until a sufficient number of characters has been generated. Do not expect your program to generate recognizable text. Bigram language models like used in the program are not very good at this. Trigram models would work better. Some examples of random 40-character output for " THis is a TEsT ": a test t tes t tes a a istes is thistes t a isthistesthis is thisthis test a is tes a a a a is a a t tes a a t is a is i