//[418919, 419139, 419163, 419092, 420392, 419436, 418413, 419907, 419653, 420192]
//[0.09987802511, 0.099930477176, 0.09993619926, 0.099919271508, 0.100229215518, 0.1000012874597, 0.0997573853696, 0.100113582557, 0.1000530242668, 0.1001815318196]
//[0.10026872126, 0.099861025976, 0.09999477864, 0.099825978487, 0.100181460164, 0.1001700160861, 0.0997136834696, 0.099964022679, 0.1000355481677, 0.0999847650710]
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class pi {

    public static void main(String[] args) {

        BufferedReader br = null;

        try {

            String sCurrentLine;
            br = new BufferedReader(new FileReader("C:\\drop\\pi.txt"));
            int i;  //the index
            int[] numcount={0,0,0,0,0,0,0,0,0,0};
            double [] probs={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
            double digs=0;
            String numbs="0123456789";
            int lenline=0,indchar=0;
            while ((sCurrentLine = br.readLine()) != null) {
                lenline=sCurrentLine.length();
                for (i=0;i<lenline;i++) {
                    if (0<=(indchar=numbs.indexOf(sCurrentLine.charAt(i)))) {
                        numcount[indchar]++;
                    }
                }

                System.out.println(sCurrentLine);
            }
            for (i=0;i<10;i++)digs=digs+numcount[i];
            for (i=0;i<10;i++)probs[i]=numcount[i]/digs;          
            System.out.println("done");
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (br != null)br.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

    }
}