<p>Write a method to compute all permutations of a string whose characters are not necessarily unique. The list of permutations should not have duplicates.</p>

<p><strong>Example1:</strong></p>

<pre>
<strong> Input</strong>: S = &quot;qqe&quot;
<strong> Output</strong>: [&quot;eqq&quot;,&quot;qeq&quot;,&quot;qqe&quot;]
</pre>

<p><strong>Example2:</strong></p>

<pre>
<strong> Input</strong>: S = &quot;ab&quot;
<strong> Output</strong>: [&quot;ab&quot;, &quot;ba&quot;]
</pre>

<p><strong>Note:</strong></p>

<ol>
	<li>All characters are English letters.</li>
	<li><code>1 &lt;= S.length &lt;= 9</code></li>
</ol>