Word Count (P.173 Ex.14)

Specification

  1. The program should accept a file name as input and then print three numbers showing the count of lines, words, and characters in the file.
  2. Assume you have a file "hello.txt" whose contents consist of the following line:
    
    1234567890123
    Hello, world.
    Hello
    World
    
    
  3. The program may run as below.
    
    Please input a file name - hello.txt
    
    4       5       40
    
    
  4. Please note that the end-of-line character (\n) also counts for one byte.