Java tutorial
import java.util.HashSet; import java.util.Set; public class Main { public static void main(String[] args) { String input = "E,E,A,B,C,B,D,C"; Set<String> set = new HashSet<String>(); for (String s : input.split(",")) set.add(s); for (String s : set) System.out.println(s); } }