/* The Great Win32 Language Shootout http://dada.perl.it/shootout/ 
   contributed by Isaac Gouy (Nice novice)

To compile:	
   nicec --sourcepath=.. -d=. -a wc.jar wc

To run:
   java -jar wc.jar < input.txt > out.txt
*/


import java.io.*;

void main(String[] args){
   let int newline = 0xA;
   let int space = 0x20;
   let int cr = 0xD;
   let int tab = 0x9;

   int value, nl = 0, nw = 0, nc = 0;
   try {
      boolean insideWord = false;
      BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
      while ((value = r.read()) != -1){
         ++nc;
         if (value == newline) ++nl;
         if (value == space || value == cr || value == newline || value == tab) 
            insideWord = false;
         else if (!insideWord) {
            insideWord = true;
            ++nw;
         }
      }
   } catch (IOException e) { System.err.println(e); }

   print(nl); print(" "); print(nw); print(" "); println(nc);
}