I\'m working on some code to balance parenthesis, this question proved most useful for the algorithm.
I implemented it in my first language (PHP) but I\'m learning Scala
You have mixed up the cases for ( and ).
(
)