using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { string[] h_temp = Console.ReadLine().Split(' '); int[] h = Array.ConvertAll(h_temp, Int32.Parse); string word = Console.ReadLine(); string[] alphabet = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" }; char[] charArray = word.ToCharArray(); int largestNum = 0; int theNum = 0; for (int i = 0; i < charArray.Length; i++) { for (int ii = 0; ii < alphabet.Length; ii++) { if (charArray[i].ToString() == alphabet[ii].ToString()) { theNum = h[i]; if (theNum > largestNum) { largestNum = theNum; } } } } int blockHeight = largestNum * largestNum; Console.WriteLine(blockHeight); } }