Replace Question Marks in String to Minimize Its Value
Each new letter costs its current count, so fill each question mark with the least used letter, then place the chosen letters in sorted order.
Each new letter costs its current count, so fill each question mark with the least used letter, then place the chosen letters in sorted order.