When a contiguous block of text is selected in a PDF viewer, the selection is highlighted with a blue rectangle. In this PDF viewer, each word is highlighted independently. For example:
There is a list of 26 character heights aligned by index to their letters. For example, 'a' is at index 0 and 'z' is at index 25. There will also be a string. Using the letter heights given, determine the area of the rectangle highlight in mm^2 assuming all letters are 1mm wide.
Example
Function Description
Complete the designerPdfViewer function in the editor below.
designerPdfViewer has the following parameter(s):
int h[26]: the heights of each letter
string word: a string
Returns
int: the size of the highlighted area
Input Format
The first line contains 26 space-separated integers describing the respective heights of each consecutive lowercase English letter, ascii[a-z].
The second line contains a single word consisting of lowercase English alphabetic letters.
When a contiguous block of text is selected in a PDF viewer, the selection is highlighted with a blue rectangle. In this PDF viewer, each word is highlighted independently. For example:![image](https://user-images.githubusercontent.com/73429989/197975449-fe822809-9559-47d3-859b-0b2e5bfebb3e.png)
There is a list of
26
character heights aligned by index to their letters. For example, 'a' is at index0
and 'z' is at index25
. There will also be a string. Using the letter heights given, determine the area of the rectangle highlight inmm^2
assuming all letters are1mm
wide.Example
Function Description
Complete the designerPdfViewer function in the editor below. designerPdfViewer has the following parameter(s):
Returns
Input Format
The first line contains
26
space-separated integers describing the respective heights of each consecutive lowercase English letter, ascii[a-z]. The second line contains a single word consisting of lowercase English alphabetic letters.Constraints
Sample Input 0
Sample Output 0
Explanation 0
We are highlighting the word abc:
Letter heights are
a=1 , b=3 , c=1
. The tallest letter,b
, is3mm
high. The selection area for this word is3 * 1mm * 3mm = 9mm^2
.Note: Recall that the width of each character is .
Sample Input 1
Sample Output 1
Explanation 1
The tallest letter in
zaba
isz
at7mm
. The selection area for this word is4 x 1mm x 7mm = 28mm^2
.