Class to determine if input is properly balanced