There are batteries nearby that can supply emergency power to the escalator for just such an occasion. The batteries are each labeled with their joltage rating, a value from 1 to 9. You make a note of their joltage ratings (your puzzle input). For example:
987654321111111
811111111111119
234234234234278
818181911112111
The batteries are arranged into banks; each line of digits in your input corresponds to a single bank of batteries. Within each bank, you need to turn on exactly two batteries; the joltage that the bank produces is equal to the number formed by the digits on the batteries you've turned on. For example, if you have a bank like 12345 and you turn on batteries 2 and 4, the bank would produce 24 jolts. (You cannot rearrange batteries.)
You'll need to find the largest possible joltage each bank can produce. In the above example:
*98*7654321111111, you can make the largest joltage possible, *98*, by turning on the first two batteries.*8*1111111111111*9*, you can make the largest joltage possible by turning on the batteries labeled 8 and 9, producing *89* jolts.2342342342342*78*, you can make *78* by turning on the last two batteries (marked 7 and 8).818181*9*1111*2*111, the largest joltage you can produce is *92*.The total output joltage is the sum of the maximum joltage from each bank, so in this example, the total output joltage is 98 + 89 + 78 + 92 = *357*.
There are many batteries in front of you. Find the maximum joltage possible from each bank; what is the total output joltage?
Now, you need to make the largest joltage by turning on exactly twelve batteries within each bank.
The joltage output for the bank is still the number formed by the digits of the batteries you've turned on; the only difference is that now there will be *12* digits in each bank's joltage output instead of two.
Consider again the example from before:
987654321111111
811111111111119
234234234234278
818181911112111
Now, the joltages are much larger:
*987654321111*111, the largest joltage can be found by turning on everything except some 1s at the end to produce *987654321111*.*81111111111*111*9*, the largest joltage can be found by turning on everything except some 1s, producing *811111111119*.23*4*2*34234234278*, the largest joltage can be found by turning on everything except a 2 battery, a 3 battery, and another 2 battery near the start to produce *434234234278*.