Highlighted Word Area

In a PDF viewer, a word is highlighted with a rectangle, and its area depends on the tallest letter in the word. The function designer_pdf_viewer receives a list h of 26 heights for the letters a through z, and a lowercase word word. The rectangle height is the maximum letter height in the word, and its width is the number of letters. Return the area of that rectangle.

Примеры

Ввод
[1, 3, 1, 3, 1, 4, 1, 3, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7], "abc"
Вывод
9
Ввод
[1, 3, 1, 3, 1, 4, 1, 3, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7], "zaba"
Вывод
28
Ввод
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "hello"
Вывод
5

Нужно реализовать

def designer_pdf_viewer(h: list[int], word: str) -> int:

Теги

arraystrings
PostgreSQLv16

Hawn jidher ir-riżultat tat-tħaddim tal-kodiċi

Visible tests
1
Input
[1,3,1,3,1,4,1,3,2,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,7], "abc"
Expected9
2
Input
[1,3,1,3,1,4,1,3,2,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,7], "zaba"
Expected28
3
Input
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], "hello"
Expected5
4
Input
[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2], "a"
Expected2
5
Input
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26], "abc"
Expected9
6
Input
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], "ab"
Expected2
Focus radio
Paused · SomaFM · Fluid