k&r; exercise 1.18 - remove trailing whitespaces