the intermediate step vector<int> h_temp would be to change all the characters in the string to the unicode value and then subtract the unicode value of ‘a’ from all the characters in h_temp. Eventually h_temp would contain the position of all the letters of the string in the alphabet relative to ‘a’. Then you can use an embedded for-loop to map each character in h_temp to a height in h and put it into h_word. To find the maximum height you would need a findMax function, like:

The logic behind the solution I wrote is very similar but without the mapping and generation of another vector array. The function getHeightOf requires the array of the heights and the string and each character in the string is converted into a position in the array within the for-loop and the maximum height is ‘saved’ for that iteration and eventually returned as the for-loop completes.