implemented character counter