MDIGITS
I tried many things, but I still get TLE 
Regards.
from array import array
from sys import stdin, stdout
def mdigits(line):
line = map(int, line.split())
occurrences = array('H', [0] * 10)
if line[0] < line[1]:
a = line[0]
b = line[1] + 1
else:
a = line[1]
b = line[0] + 1
for number in map(str, range(a, b)):
for digit in number:
occurrences[int(digit)] += 1
result = ""
for x in occurrences:
result += "%d " % x
return result + "\n"
output = []
input = stdin.readlines()
for line in input[:-1]:
output.append(mdigits(line))
stdout.writelines(output)