+ 4

Average Word Length

guys I solved this question and I'm 100% positive I did it perfectly. Can anyone tell me if there's something you can see but I can't ? here is my code https://code.sololearn.com/chLUoNm885Xc

5th Sep 2021, 7:03 PM
Ammar Abdoh
Ammar Abdoh - avatar
8 Respostas
+ 3
You should use regular expression in the replaceAll() method. Something like that: String str3= str.replaceAll("[ ,.!?]", ""); Coding Cat is right.
6th Sep 2021, 12:18 AM
Artsiom
Artsiom - avatar
+ 3
AmmarTerRAM question asks to remove all punctuation as well . Or just don't count them.
5th Sep 2021, 7:53 PM
Abhay
Abhay - avatar
+ 2
It looks good with ceilling. Only case #1 fails. That's because of the question mark at the end (.... that?). Don't count any punctuation!
5th Sep 2021, 8:11 PM
Coding Cat
Coding Cat - avatar
+ 1
AmmarTerRAM rounding up to the nearest whole number is what ceil do . round will give you 5 instead of 6 as shown in example in the question.
5th Sep 2021, 7:46 PM
Abhay
Abhay - avatar
5th Sep 2021, 7:34 PM
Ammar Abdoh
Ammar Abdoh - avatar
0
Martin Taylor is right , question asks to round up (ceil). Can't understand why would anyone dislike his answer.
5th Sep 2021, 7:41 PM
Abhay
Abhay - avatar
0
Abhay Martin Taylor // Guys read the question, it says round up to the nearest whole number, that's exactly what round() do, so please tell me if there is something else I can do
5th Sep 2021, 7:45 PM
Ammar Abdoh
Ammar Abdoh - avatar
0
Abhay I used ceil but still it gives me wrong test cases, any idea why?
5th Sep 2021, 7:49 PM
Ammar Abdoh
Ammar Abdoh - avatar