NB. count '(' and ') in the input http://adventofcode.com/day/1 echo -/+/"1 '()'=/ t=. 1!:1 {:ARGV NB. find first 'negative' balance position echo >:_1 i.~+/\<:+:*'('= t exit 0