Facebook Hackercup 2013: Balanced Smileys
The solution is correct because the "}" and "{" symbols are considered "optional" parentheses.

(:):):(:::) → (}}{}


The left one is an example of an input string, the right is the preprocessed version of it.  If you read the algorithm, you see that they keep two values,

min_level, max_level = (0, 0).


Reading the actual solution should convince you.