字符串排序1
字符串排序(1)
http://www.nowcoder.com/questionTerminal/251845265711496da75c59126725f76b
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNextLine()) { int n=Integer.parseInt(sc.nextLine()); String[] s=sc.nextLine().split(" "); TreeSet<String> set=new TreeSet<String>(); for(int i=0;i<s.length;i++){ set.add(s[i]); } for(String str:set){ System.out.print(str+" "); } } } }