вывод нормальный
package com.javarush.task.task19.task1924;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
/*
Замена чисел
*/
public class Solution {
public static Map<Integer, String> map = new HashMap<Integer, String>();
static {
map.put(0, "ноль");
map.put(1, "один");
map.put(2, "два");
map.put(3, "три");
map.put(4, "четыре");
map.put(5, "пять");
map.put(6, "шесть");
map.put(7, "семь");
map.put(8, "восемь");
map.put(9, "девять");
map.put(10, "десять");
map.put(11, "одиннадцать");
map.put(12, "двенадцать");
}
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
BufferedReader bufferedFileReader = new BufferedReader(new FileReader(bufferedReader.readLine()));
bufferedReader.close();
while (bufferedFileReader.ready()) {
String tmp = bufferedFileReader.readLine();
tmp = tmp.replaceAll("\\s0\\s", " " + map.get(0) + " ");
tmp = tmp.replaceAll("\\s1\\s", " " + map.get(1) + " ");
tmp = tmp.replaceAll("\\s2\\s", " " + map.get(2) + " ");
tmp = tmp.replaceAll("\\s3\\s", " " + map.get(3) + " ");
tmp = tmp.replaceAll("\\s4\\s", " " + map.get(4) + " ");
tmp = tmp.replaceAll("\\s5\\s", " " + map.get(5) + " ");
tmp = tmp.replaceAll("\\s6\\s", " " + map.get(6) + " ");
tmp = tmp.replaceAll("\\s7\\s", " " + map.get(7) + " ");
tmp = tmp.replaceAll("\\s8\\s", " " + map.get(8) + " ");
tmp = tmp.replaceAll("\\s9\\s", " " + map.get(9) + " ");
tmp = tmp.replaceAll("\\s10\\s", " " + map.get(10) + " ");
tmp = tmp.replaceAll("\\s11\\s", " " + map.get(11) + " ");
tmp = tmp.replaceAll("\\s12\\s", " " + map.get(12) + " ");
System.out.println(tmp);
}
bufferedFileReader.close();
}
}