Seriously I have no idea why this code is not passing. I use FileReader for reading a file's contents and also I close the FileReader stream using try-with-resources. Does anybody have any idea why it's not passing?
package com.codegym.task.task19.task1926;
/*
Mirror image
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
String fileName;
BufferedReader readerS = new BufferedReader(new InputStreamReader(System.in));
fileName = readerS.readLine();
readerS.close();
File file = new File(fileName);
FileReader fileReader = new FileReader(file);
BufferedReader reader = new BufferedReader(fileReader);
reader.lines()
.map(StringBuilder::new)
.map(StringBuilder::reverse)
.forEach(System.out::println);
fileReader.close();
reader.close();
}
}