#Groovy, 48 bytes {a,b,c->(a..b).collect{"$it".count("$c")}.sum()}