import java.util.ArrayList;
import java.util.Collections;
public class Solution {
ArrayList list = new ArrayList();
public ArrayList Permutation(String str) {
char a[]=str.toCharArray();
f(a,0);
Collections.sort(list);
return list;
}
public void f(char a[],int k){
if(k==a.length-1)
list.add(new String(a));
for(int i=k;i
while(i!=k&&i
i++;
if(i==a.length)
break;
char temp=a[k];
a[k]=a[i];
a[i]=temp;
f(a,k+1);
temp=a[k];
a[k]=a[i];
a[i]=temp;
}
}
}