check string permutation