added code  for string permutation