Consider $d$ disjoint closed subintervals of the unit interval and consider an orientation preserving expanding map which maps each of these subintervals to the whole unit interval. The set of points where all iterates of this expanding map are defined is a Cantor set. Associated to the construction of this Cantor set is the scaling function which records the infinitely deep geometry of this Cantor set. This scaling function is an invariant of $C^1$ conjugation. We solve the inverse problem posed by Dennis Sullivan: given a scaling function, determine the maximal possible smoothness of any expanding map which produces it.