void printhighchangeablesconst mapadjacentwordsint minwords forauto entry adjacentwords const vector words entry secondifwords size>minwords cout <entry first <(<words size<"):"forauto str words cout <<strcout <endlfigure given map containing words as keys and vector of words that differ in only one character as valuesoutput words that have minwords or more words obtainable by one-character substitution one-character substitution the routine in figure shows how the map that is eventually produced (we have yet to write code for that partcan be used to print the required answers the code uses range for loop to step through the map and views entries that are pairs consisting of word and vector of words the constant references at lines and are used to replace complicated expressions and avoid making unneeded copies the main issue is how to construct the map from an array that contains the , words the routine in figure is straightforward function to test if two words are identical except for one-character substitution we can use the routine to provide the simplest algorithm for the map constructionwhich is brute-force test of all pairs of words this algorithm is shown in figure if we find pair of words that differ in only one characterwe can update the map at lines and the idiom we are using at line is that adjwords[strrepresents the vector of words that are identical to strexcept for one character if we have previously seen strthen it is in the mapand we need only add the new word to the vector in the mapand we do this by calling push_back if we have never seen str beforethen the act of using operator[places it in the mapwith vector of size and returns this vectorso the push_back updates the vector to be size all in alla super-slick idiom for maintaining map in which the value is collection the problem with this algorithm is that it is slow and takes seconds on our computer an obvious improvement is to avoid comparing words of different lengths we can do this by grouping words by their lengthand then running the previous algorithm on each of the separate groups to do thiswe can use second maphere the key is an integer representing word lengthand the value is collection of all the words of that length we can use vector to