Работает код корректно. Но не прохожу валидацию (пункты 2-5). Подскажите. Буду признателен
package com.javarush.task.task18.task1825;
import java.io.*;
import java.util.*;
/*
Собираем файл
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String fileName = reader.readLine();
Map<Integer, String> map = new TreeMap<>();
String[] s = fileName.split("\\.part\\d{1,}");
String path = s[0];
FileOutputStream fileOutputStream = new FileOutputStream( "C:\\Users\\Inch\\Desktop\\tmp\\" + path + ".txt");
while (!fileName.equals("end")) {
int numberOfPart = fileName.lastIndexOf("t") + 1;
int key = Integer.parseInt(fileName.substring(numberOfPart));
map.put(key, fileName);
fileName = reader.readLine();
}
reader.close();
for (Map.Entry<Integer, String > pair: map.entrySet()) {
FileInputStream fileInputStream = new FileInputStream( "C:\\Users\\Inch\\Desktop\\tmp\\" + pair.getValue() + ".txt");
byte[] buffer = new byte[fileInputStream.available()];
while (fileInputStream.available() > 0) {
int count = fileInputStream.read(buffer);
fileOutputStream.write(buffer, 0, count);
}
fileInputStream.close();
}
fileOutputStream.close();
}
}