His comment is written in this link:
https://codegym.cc/quests/lectures/questcore.level09.lecture11
and there he wrote the followings:
>>Attention "Replacing numbers"!
. . . the example given is WRONG - I mean the number and dot immediately after is not counted as number, only when there is a space before and after the number.<<
(Ivan Duka Level 22 , Winnipeg, Canada 23 April 2019, 02:20)
1) Is he right or not?
2) And my second question: what do you think what's wrong with my code?
package com.codegym.task.task19.task1924;
/*
Replacing numbers
*/
import java.io.*;
import java.util.*;
public class Solution {
public static Map<Integer, String> map = new HashMap<Integer, String>();
static {
map.put(0, "zero");
map.put(1, "one");
map.put(2, "two");
map.put(3, "three");
map.put(4, "four");
map.put(5, "five");
map.put(6, "six");
map.put(7, "seven");
map.put(8, "eight");
map.put(9, "nine");
map.put(10, "ten");
map.put(11, "eleven");
map.put(12, "twelve");
}
public static void main(String[] args) throws Exception {
BufferedReader readConsole = new BufferedReader(new InputStreamReader(System.in));
String fileName = readConsole.readLine();
readConsole.close();
BufferedReader bfr = new BufferedReader(new FileReader(fileName));
ArrayList<String> fileContent = new ArrayList<>();
String[] line = null;
while (bfr.ready()) {
line = bfr.readLine().split(" ") ;
for (int i=0; i < line.length; i++) {
try {
if (Integer.parseInt(line[i]) >= 0 && Integer.parseInt(line[i])<13) {
if (i != 0) fileContent.add(" ");
fileContent.add(map.get(Integer.parseInt(line[i])));
}
else {
if (i != 0) fileContent.add(" ");
fileContent.add(line[i]);
}
}
catch (Exception ign) {
if (i != 0) fileContent.add(" ");
fileContent.add(line[i]);
}
}
// új sort indítani ne feledj!
fileContent.add("\n");
}
bfr.close();
for (String s : fileContent) {
System.out.print(s);
}
}
}