// -*- mode: java -*- // $Id: wc.njs,v 1.1 2001/07/10 02:36:59 doug Exp $ // http://www.bagley.org/~doug/shootout/ // from David Hedbor // modified by Aldo Calpini <dada@perl.it> for Win32 var nl = 0, nw = 0, nc = 0; // line, word and character counters var buf, i; var stdin = WScript.StdIn; while(!stdin.AtEndOfStream) { buf = stdin.readLine(); if(buf.length > 0) { nc += buf.length; var words = buf.split(/\s+/); nw += words.length; } nc += 1; nl += 1; // WScript.Echo(nl, nw, nc); } WScript.Echo(nl, nw, nc);