Designer PDF Viewer

https://www.hackerrank.com/challenges/designer-pdf-viewer

input

The first line contains 26 space-separated integers describing the respective heights of each consecutive lowercase English letters.

The second line contains a single word, consisting of lowercase English alphabetic letters.

Sample 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 5
abc

In [5]:
h = [int(i) for i in input().strip().split(" ")]
word = input().strip()

h = dict(zip([chr(i+97) for i in range(26)], h))

maxH = None
for i in word:
    if maxH == None or h[i] > maxH:
        maxH = h[i]

print(maxH * len(word))


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 5
abc
9

In [ ]: