Files

31 lines
851 B
Java
Raw Permalink Normal View History

2017-03-05 00:26:42 -06:00
// Author: Rodney Shaghoulian
2018-07-27 16:45:56 -07:00
// Github: github.com/RodneyShag
// HackerRank: hackerrank.com/RodneyShag
2017-03-05 00:26:42 -06:00
import java.util.Scanner;
public class Solution {
private static final int letters = 26;
2017-09-11 09:32:17 -07:00
public static void main(String[] args) {
2017-04-05 18:42:35 -05:00
/* Save input */
2017-03-05 00:26:42 -06:00
Scanner scan = new Scanner(System.in);
int [] height = new int[letters];
for (int i = 0; i < letters; i++){
height[i] = scan.nextInt();
}
String str = scan.next();
scan.close();
/* Calculate and print area */
int maxHeight = 0;
for (int i = 0; i < str.length(); i++) {
int index = str.charAt(i) - 'a';
maxHeight = Math.max(maxHeight, height[index]);
}
int area = maxHeight * str.length();
System.out.println(area);
}
}