title: Finding all the unique permutations of a string without generating duplicates
body: <p>Finding all the permutations of a string is by a well known Steinhaus–Johnson–Trotter algorithm. But if the string contains the repeated characters such as<br>
  AABB,<br>
  then the possible unique combinations will be 4!/(2! * 2!) = 6</p>
  
  <p>One way of achieving this is that we can store it in an array or so and then remove the duplicates.</p>
  
  <p>Is there any simpler way to modify the Johnson algorithm, so that we never generate the duplicated permutations. (In the most efficient way)</p>