added test for exact count
added static helper function to check whether string has braces and added tests