Write a program in C++ language A shrinkable word is a word with more than two characters
Question:
Write a program in C++ language
A shrinkable word is a word with more than two characters that can be reduced down to a two-character c-string by deleting one character at a time such that, at each stage, the remaining c-string is a word that must be found in a two-dimensional c-string array.
For example, to check if the word startling is shirnkable we start by deleting one character; it could be any character in the word. When trying to delete the character 'l', the c-string becomes starting which is a c-string found int the two-dimensional array dictionary. Next, we continue by trying to delete another character which turns out to be the second 't' and the c-string becomes staring. In the same fashion, the c-string becomes string, sting, sing, sin, and finally in which must also be found in the dictionary. At this point, the original word (i.e. startling) is considered shrinkable.
An example of non-shrinkable word is table. When trying to delete one character, we get the c-string able. However, when trying to remove another character, none of the generated c-strings can be found in the dictionary (i.e. ble, ale, abe, abl). Hence, the word table is considered non-shrinkable.
Complete the function given below which has three formal parameters:
A c-string (i.e. word) which contains the word to be tested if it is shrinkable or not.
A two-dimensional c-string array (i.e. dictionary) which contains the list of words that are checked against during the shrinking process.
An integer variable (i.e. rows) which represents the numbers of rows in the dictionary array.
The function must output the new shrinked c-string at each stage on a new line. The function must return true if the word is shrinkable to a two-letter c-string, or false otherwise.
No modifications are permitted to the function header
The function can be coded in two ways: as a recursive function or a normal function
You can assume that the c-string "word" and array "dictionary" only contains lower case alphabetical characters