Problem of the Day: Smiley Face

Smiley Face

Goal is to verify whether there are matching parenthesisisisisis while crawling through text that can contain a smiley emoticon “:)” that doesn’t count.

Quick idea is to use Java’s built-in split() function to pull out the emoticon, put the string back together, and count the parenthesisisisisis with a simple +/- counter. If the end result is 0 then the parenthesisisisisisisisisisisisisis match!.

Otherwise it’d be parsing the string and not counting any “)” that has a “:” before it. More work than I want to do though.