// -*- mode: c++ -*- // $Id: wc.g++,v 1.4 2001/07/08 18:45:52 doug Exp $ // http://www.bagley.org/~doug/shootout/ #include <iostream> #include <vector> using namespace std; enum { OUT, IN }; int main(int argc, char *argv[]) { char c; int nl, nw, nc, state; ios_base::sync_with_stdio(false); cin.tie(0); state = OUT; nl = nw = nc = 0; while (cin.get(c)) { ++nc; if (c == '\n') ++nl; if (c == ' ' || c == '\n' || c == '\t') state = OUT; else if (state == OUT) { state = IN; ++nw; } } cout << nl << " " << nw << " " << nc << endl; }