makeLargestSpecial
that takes a special binary string S
as input.mountains
to store the decomposed mountains from the string S
.S
and decompose it into mountains. Increment a counter for each '1' and decrement for each '0'. When the counter reaches zero, a mountain is found.makeLargestSpecial
on the interior of the mountain (excluding the first '1' and the last '0').mountains
list.mountains
list in descending order to get the lexicographically largest sequence.