Changed the program to work with for loop

Now it uses double instead of long, so it's able to peform a more
acurate character counting.