# Replacing numbers

• 20
• Locked
1. In a static block, initialize map with (number, word) pairs from 0 to 12 inclusive. For example, (0, "zero"), (1, "one"), (2, "two") 2. Read the file name from the console, and then read the contents of the file. 3. Use map to replace all of the numbers with words. 4. Display the result. 5. Close
You can't complete this task, because you're not signed in.
Gellert Varga
Level 23 , Szekesfehervar, Hungary
17 October 2021, 19:37
TEST INPUT: az 1 ez 12 12. 12? 11- 11) amaz Bla2blabla 2. I1n 0 masodik 3 sor 5 5. 5* 5/ 8 In 7! vi4ew 9- 11 11b 11c a11b 6view 13, OUTPUT OF A FAILED CODE: az one ez twelve 12. 12? 11- 11) amaz Bla2blabla 2. I1n zero masodik three sor five 5. 5* 5/ eight In 7! vi4ew 9- eleven 11b 11c a11b 6view 13, OUTPUT OF MY ACCEPTED CODE: az one ez twelve twelve. twelve? eleven- eleven) amaz Bla2blabla two. I1n zero masodik three sor five five. five* five/ eight In seven! vi4ew nine- eleven elevenb elevenc a11b 6view 13,
13 March 2021, 15:46
No need to account for negative values, only positive (0-12).
Aleksandr
Level 22 , Moscow, Russian Federation
8 March 2021, 17:25
Dear codeGym did your correct solution do your Verification on this task? i did this task, but sometimes i watch on correct solution to improve my skill, but in this task for me it was blowmind. Because you correct solution did not give result, that you are waiting for in condition. How you can explain that? For example, "12." in condition you are awaitng "twelve." result, but your "correct solution" give "12.". Also it did not avoid situation which can be if you write text like: 1) 12) 2) 12. 3) 12? 4) 12! 5) 12, Please improve this.
Roman
Level 41
9 March 2021, 07:20
Thanks, we'll fix it as soon as possible.
LennyMan
Level 25 , Lucca, Italy
10 January 2021, 14:59
Taking the exampleof the task: The "12." was a problem for the logic of my implementation, so i just tried to add the space in the file , now is (12 . ) and now the program its working and it pass the validation
Dave Andrea
28 September 2020, 01:02
Fought with the validator for hours. Turns out you have to use the FileWriter(String string) constructor, not the FileWriter(File file). As much as I love CodeGym, and I do love it, this is a piss off.
Attila
Level 25
29 April 2020, 22:03
If you struggle with this task: https://www.regular-expressions.info/wordboundaries.html
Jurij Thmsn
Level 29 , Flensburg, Germany
21 April 2021, 15:48
thanks so much man, i was going insane already ðŸ¤¯
Justin Smith
Level 38 , Greenfield, USA, United States
10 November 2021, 16:19
I was so confused by this page that I feel obligated to offer a clarification. A word boundary character is a letter or number. That's it. It's already defined in the system. I was trying to figure out for so long how to tell the regex what I wanted to use as a word boundary. Also, regex is a complex subject that really should have been given an entire lesson chapter. Especially considering how many tasks are about it.
Gellert Varga
Level 23 , Szekesfehervar, Hungary
10 November 2021, 23:19
Very useful links: https://docs.oracle.com/javase/tutorial/essential/regex/pre_char_classes.html https://regexone.com/ https://en.wikipedia.org/wiki/Regular_expression But I still solved the tasks without regex. I only say this because I don't think it's mandatory to use regex for these tasks, and the validator accepts other solutions that work. And I think a word boundary is not a character: the word boundary has zero length. (And any character has one length.)
Justin Smith
Level 38 , Greenfield, USA, United States
11 November 2021, 14:05
Yes, you're right. What I meant was what characters it looks for in determining if a word boundary exists.
Angelika
Level 25 , Budapest, Hungary
26 January 2020, 18:59
Could anyone help me, whats the problem with my solution? Thanks!
Roman
Level 41
31 January 2020, 08:20
Please refer to Help section at our course.