string permutation with duplicate chars