1. For each index/word pair store the number of repeats of each character. 2. INIT: Start with the index/word pair that has the highest value by itself (i.e. assuming the value of other index/words are zero). 3. Choose the next index/word pair that increases the value the most (let's say your init value for 1/alabama, then you move to index = 2 and look for the best next increase.) 4. Repeat step-3 until you exhaust all indices. 5. Now you have a local optimum based on your starting point. 6. EXCHANGE: Store the current objective, Go back to index = 1 and pick the second best word in index = 1. Now check if you could improve the previous solution by exchanging index = 2 with something new etc. 7. You can repeat this exercise for certain number of iterations and then you stop with the best solution found thus far. NOTE that you can also use randomized approach to randomly pick an element to exchange and try to improve the solution.