public class Solution { public static String[] strings; public static void main(String[] args) { //write your code here strings = new String[6]; String temp = "Somethig"; Scanner console = new Scanner(System.in); for (int x = 0; x < 6; x++) { strings[x] = console.nextLine(); } for (int x = 0; x < 5; x++) { if (strings[x].equals(null)) continue; temp = strings[x]; for (int y = x + 1; y < strings.length -1; y++) { if (temp.equals(strings[y])) strings[y] = null; } } for (int i = 0; i < strings.length; i++) { //System.out.print(strings[i] + ", "); } } }