Count characters in input; 2nd version. Section 1.5.2, page 18