cognizance-amrita / hacktoberfest

An initiative to promote Hacktoberfest
MIT License
0 stars 35 forks source link

Designer PDF Viewer #124

Closed ndrohith09 closed 1 year ago

ndrohith09 commented 1 year ago

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

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

image

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

image

Sample Input 0

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

Sample Output 0

9

Explanation 0

We are highlighting the word abc:

Letter heights are a=1 , b=3 , c=1. The tallest letter, b, is 3mm high. The selection area for this word is 3 * 1mm * 3mm = 9mm^2.

Note: Recall that the width of each character is .

Sample Input 1

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

Sample Output 1

28

Explanation 1

The tallest letter in zaba is z at 7mm. The selection area for this word is 4 x 1mm x 7mm = 28mm^2.

Manitejabhumaraju commented 1 year ago

@ndrohith09 i want to solve this problem using python

Gamer5262 commented 1 year ago

I would like to contribute to this problem in c++

jaichiranjeeva commented 1 year ago

I would also like to solve this in Java