using induced sorting for LMS strings