import java.io.*;
import java.util.*;
import java.net.*;
//_____________________________________________________________
public class pat
{ 
   int[] factors = new int [100];
   int[] factors2 = new int [100];
   int cnt = 0;
   int total = 0;
//_____________________________________________________________
public static final void main(String[] args) throws Exception
{
   pat bnk = new pat();
   bnk.start();
}
//_____________________________________________________________
pat() throws Exception 
{
}
//___________________________________________________________________________
void start()
{
   String sent = "";
   cnt = 0;
   String[] files = data.getdir("books");
   for (int i = 0; i < files.length; i++)
   {
      String[] lines = data.getFile(files[i]).split("\r\n");

      for (int j = 0; j < lines.length; j++)
      {
         int pos = lines[j].indexOf(".");
         if (pos < 0)
         {
            sent += lines[j] + " ";
         }
         else
         {
            String left = lines[j].substring(0,pos+1);
            String right = lines[j].substring(pos+1);
            sent += left;
            sentence(sent);
            sent = right + " ";
         }
      }
   }
   System.out.println("");
   int fc = 1;
   int fc2 = 1;
   for (int i = 0; i < factors.length; i++)
   {
      if (factors[i] > 0) fc = factors[i]; else fc = 1;
      if (factors2[i] > 0) fc2 = factors[i]; else fc2 = 1;
      System.out.print(i + " " + factors[i] + " " + (total / fc) + " ");
      System.out.println(factors2[i] + " " + (total / fc2));
   }
   System.out.println(total / cnt / 777);
}
//___________________________________________________________________________
void sentence(String str)
{
   total++;
   //System.out.println(str +  "\r\n");
   for (int i = 0; i < 10; i++) str = str.replace("  "," ");
   String[] words = str.split(" ");
   str = str.replace(" ","");
   
   for (int i = 1; i < factors.length; i++)
   {
      if (words.length % i == 0) factors[i]++;
   }
   for (int i = 1; i < factors.length; i++)
   {
      if (str.length() % i == 0) factors2[i]++;
   }
   if (str.trim().equals("")) return;
   int pla = data.place(str);
   int val = data.value(str);
   if (pla % 777 == 0) 
   {
      if (val % 777 == 0)
      {
         if (pla > 0)
         {
            System.out.print(".");
            cnt++;
         }
      }
   }
}
}//__________________________________________________________________________
