Write a program that finds the distribution of leading digits in a set of positive integers

Hi so in my class I have to create a program that outputs this:

Let us count those leading digits...

input file name? 4BenfordLinear.txt

Digit Count Percent

  1     5  11.11

  2     5  11.11

  3     5  11.11

  4     5  11.11

  5     5  11.11

  6     5  11.11

  7     5  11.11

  8     5  11.11

  9     5  11.11

Total    45 100.00

Essentially, the user inputs a textfile and the program is supposed to count the number of leading digits it has. I have no idea how to do this please help.