import java.util.*;
public class 串中取3个不重复字母 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner reader=new Scanner(System.in);
String s=reader.nextLine();
ArrayList<Character> array=new ArrayList<Character>();
char[] c=s.toCharArray();
for(int i=0;i<c.length;i++){
if(array.contains(c[i]))
continue;
else
array.add(c[i]);
}
String ss="";
backtrace(array,0,ss);
}
public static void backtrace(ArrayList<Character> array,int count,String s){
if(s.length()==3)
System.out.println(s);
for(int i=count;i<array.size();i++){
s+=array.get(i);
count=i;
backtrace(array,count+1,s);
s=s.substring(0,s.length()-1);
}
}
}
串中取3个不重复字母
最新推荐文章于 2019-07-26 22:29:20 发布