import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Scanner;
/*
Фейсконтроль
*/
public class Solution {
public static void main(String[] args) {
Scanner scan = null;
try {
scan = new Scanner(System.in);
System.out.println("Введите путь к файлу");
String path = scan.nextLine();
List<String> newRead = Files.readAllLines(Path.of(path));
for (String s : newRead) {
System.out.print(s.replaceAll("[., ]", ""));
}
}catch (Exception e){
}finally {
scan.close();
}
}
}
package com.javarush.task.pro.task15.task1506;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Scanner;
/*
Фейсконтроль
*/
public class Solution {
public static void main(String[] args) {
Scanner scan = null;
try {
scan = new Scanner(System.in);
System.out.println("Введите путь к файлу");
String path = scan.nextLine();
List<String> newRead = Files.readAllLines(Path.of(path));
for (String s : newRead) {
System.out.print(s.replaceAll("\\s|\\.|\\,", ""));
}
}catch (Exception e){
}finally {
scan.close();
}
}
}