string divide algorithm