-- -*- mode: eiffel -*- -- $Id: wc.se,v 1.1 2001/05/14 17:39:13 doug Exp $ -- http://www.bagley.org/~doug/shootout/ class WC creation make feature make is local nl, nw, nc, state: INTEGER; c: CHARACTER; do nl := 0 nw := 0 nc := 0 state := 0 from io.read_character until io.end_of_input loop c := io.last_character nc := nc + 1 if c = '%N' then nl := nl + 1 end if c = ' ' or c = '%N' or c = '%T' then state := 0 else if state = 0 then state := 1 nw := nw + 1 end end io.read_character end std_output.put_integer(nl) std_output.put_character(' ') std_output.put_integer(nw) std_output.put_character(' ') std_output.put_integer(nc) std_output.put_character('%N') end end