solution from length