import java.io.*;
public class Compteur {
   public static void main(String args[]){
     int nNombres=0;
     int nMots=0;
     Reader r=null;
     StreamTokenizer st=null;
     try { 
       r = new BufferedReader(new FileReader(args[0]));
       st = new StreamTokenizer(r);}
     catch (IOException e)
        {System.out.println("usage : java Compteur <filename>");
         try {r.close();}  catch (IOException e1) {};  
         System.exit(1);}
     st.eolIsSignificant(true);
     st.wordChars((int) '_',(int)'_');
     st.ordinaryChar((int) '.');
     try 
       {while (st.nextToken()!=st.TT_EOF)
         {if (st.ttype== st.TT_WORD) 
            {System.out.println(st.sval);   
             nMots++;}
          if (st.ttype== st.TT_NUMBER) 
            {System.out.println(st.nval);   
             nNombres++;}
        } } // while
     catch (IOException e)
       {System.out.println("error when reading.");}
     finally 
       {try {r.close();} catch (IOException e1) {};} 
     System.out.println("mots : "+ nMots);
     System.out.println("nombres : "+ nNombres);     
    } //main
 }