CodeChef (AUG17 LunchTime) : Mathison and pangrams - MATPAN
Problem: Mathison and pangrams Mathison recently inherited an ancient papyrus that contained some text. Unfortunately, the text was not a pangram . Now, Mathison has a particular liking for holoalphabetic strings and the text bothers him. The good news is that Mathison can buy letters from the local store in order to turn his text into a pangram. However, each letter has a price and Mathison is not very rich. Can you help Mathison find the cheapest way to obtain a pangram? Input The first line of the input file will contain one integer, T , representing the number of tests. Each test will be formed from two lines. The first one contains 26 space-separated integers, representing the prices of all letters. The second will contain Mathison's initial text (a string of N lowercase letters). Output The output file will contain T lines, one for each test. Each line will contain the answer for the corresponding test. Constraints : 1 ≤ T ≤ 10 1 ≤ N ≤...