An application of Hajos factorizations to variable-length codes