-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathSolution.java
More file actions
28 lines (23 loc) · 764 Bytes
/
Solution.java
File metadata and controls
28 lines (23 loc) · 764 Bytes
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
27
28
// github.com/RodneyShag
import java.util.Scanner;
public class Solution {
private static final int letters = 26;
public static void main(String[] args) {
/* Save input */
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);
}
}