polo the penguin and numbers--TLE

c
easy
tle

#1

#include<stdio.h>

int no_dig(long long a){

  if(a<10)

   return 1;

if(a<100)

   return 2;

if(a<1000)

   return 3;

if(a<10000)

   return 4;

if(a<100000)

   return 5;

if(a<1000000)

   return 6;

if(a<10000000)

   return 7;

if(a<100000000)

   return 8;

if(a<1000000000)

   return 9;
if(a==1000000000)

   return 10;
}

int main(){


 int t=0;

long long c,d,i,sum=0;

scanf("%d",&t);

while(t-- > 0){

  scanf("%lld %lld",&c,&d);

  for(i=c;i<=d;i++){

     sum=(sum%1000000007+(i%(1000000007)*(no_dig(i)%1000000007))%1000000007)%1000000007;
 }

 printf("%lld

",sum);

 sum=0;

}
//getch();
return 0;

}

//here the main reason for TLE is for teh time taken to count the number of digits in a number.what is the efficient way to count the number of digits