Кто подскажет в чем проблема, почему мой код не принимает, хотя он идентичен правильному решению. Вот мой код: public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String str1 = scanner.nextLine(); String str2 = scanner.nextLine(); Path path1=Path.of(str1); Path path2=Path.of(str2); if(path1.getFileName()!=null||path2.getFileName()!=null) { try { System.out.println(path1.relativize(path2)); }catch (Exception ignored) { } } } Вот решение от джавараш: public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String str1 = scanner.nextLine(); String str2 = scanner.nextLine(); Path path1 = Path.of(str1); Path path2 = Path.of(str2); try { System.out.println(path1.relativize(path2)); } catch (Exception ignored) { } } Мой вариант все проверки прошел, кроме 3 условия