#Brain-Flak, 118 84 + 1 = 85 bytes
Brain-Flak, 118 84 + 1 = 85 bytes
([[]]<{({}<>)((((()()()()()){}){}){})<>}>()){({}()<(<>({})<>())>)}{}<>{}{({}<>)<>}<>
This requires the -fc
flag to run giving it an extra byte. -f
flag is standard for passing input.
##Explanation
Explanation
([[]]< #Store a copy of the stack height before hand in the scope
{ #While there is something on the stack...
({}<>) #Move something over and...
((((()()()()()){}){}){}) #Put a paren on top
<> #Swap back
}
>()) #Put the 1-stack height down
{ #While that is not zero
({}()< #Add one and
(<>({})<>())#Silently move a copy of the top of the other stack over (close paren)
>)
}{}
<>{} #Remove extra open paren
{({}<>)<>}<> #Combine the two stacks