Explanation
First, an observation of mine:
If the input is n digits long, the first digit will appear in the triangle n times, the second digit will appear n-1 times, and so on onto the last digit, which will appear once. We can take advantage of this, since it's really easy to calculate how many digits of input are left in brain-flak, namely
[]
So here's how the code works.
# Push the size of the input (to account for 0's)
([])
# Push...
(
# While True
{
# Pop the stack height (evaluates to 0)
<{}>
# For each digit *D*...
# While true
{
# Decrement the counter (the current digit we're evaluating),
# but evaluate to 0
<({}[()])>
# Evaluate the number of digits left in the input
[]
# Endwhile
}
# This whole block evaluates to D * len(remaining_digits), but
# without affecting the stack
# Since we looped D times, D is now 0 and there is one less digit.
# Pop D (now 0)
{}
# Push the stack height (again, evaluating it as 0)
<([])>
# End while
}
# Pop a 0 off (handles edge case of 0)
{}
# end push
)