length (size) preserving rewriting