package 去除字符串重复;
import java.util.Scanner;
public class StringDemo {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String arr=sc.nextLine();
StringBuffer buffer=new StringBuffer();
for (int i = 0; i < arr.length(); i++) {
if(!(buffer.toString().contains(arr.charAt(i)+""))){
buffer.append(arr.charAt(i));
}
}
System.out.println(buffer);
}
}
|
|