import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int n = sc.nextInt(); if(n == 0) { break; } List<String> list = new ArrayList<>(); for(int i = 0; i < n; i ++) { list.add(sc.next()); } Collections.sort(list); for(int i = 0; i < n; i ++) { String s = list.get(i); if(s.length() > 4 && s.substring(s.length() - 4, s.length()).equals(".exe")) { String s1 = s.substring(0, s.length() - 4); if(list.indexOf(s1) != -1) { System.out.println(s); } } } } } } |
Double click to view unformatted code.