h = {} h_temp = io.read() h_i = 65; for token in string.gmatch(h_temp, "[^%s]+") do h[h_i] = tonumber(token) h_i = h_i + 1 end word = io.read() word = word:upper() w= {} max = 0 for i in string.gmatch(word, ".") do a = h[i:byte(1,1)] --print(a) if(a> max) then max = a end end print(max * word:len())