my solution to character count