implement string permuter