Добрый день!
Все варианты входных данных проходит, но проверка не проходит на втором пункте. Помогите.
package com.javarush.task.pro.task05.task0508;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/*
Удаляем одинаковые строки
*/
public class Solution {
public static String[] strings = new String[6];
public static void main(String[] args) throws IOException {
//напишите тут ваш код
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i < 6; i++) {
String str = buffer.readLine();
strings[i] = str;
}
// Заполняем повторы null
String temp = "";
boolean check = false;
OUTER:
for (int i = 0; i < strings.length; i++) {
temp = strings[i];
check = false;
INNER:
for (int j = i + 1; j < strings.length; j++) {
if (strings[i] == null) {
continue OUTER;
}
if (j == strings.length - 1 && check == true) {
strings[i] = null;
}
if (strings[j] == null) {
} else {
if (strings[j].equals(temp)) {
strings[j] = null;
check = true;
}
}
}
}
for (int i = 0; i < strings.length; i++) {
System.out.print(strings[i] + ", ");
}
}
}