Average Word Length | Sololearn: Learn to code for FREE!

+2

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

9/5/2021 7:03:19 PM

AmmarTerRAM

10 Answers

New Answer

+3

You should use regular expression in the replaceAll() method. Something like that: String str3= str.replaceAll("[ ,.!?]", ""); Coding Cat is right.

+3

AmmarTerRAM question asks to remove all punctuation as well . Or just don't count them.

+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!

+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.

0

this is the question https://www.sololearn.com/coach/73?ref=app

0

Martin Taylor is right , question asks to round up (ceil). Can't understand why would anyone dislike his answer.

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

0

Abhay I used ceil but still it gives me wrong test cases, any idea why?