character counter for backend