+ 14

Error in code coach

I am stuck in "average word length" code coach problem I am getting output '4' in 1st test case but the expected output is '3' Why this happens I can't understand and all the other test cases are giving right output 1st test case string: "Can you not do that?" Expected output : 3 My output : 4 Please help https://code.sololearn.com/c9y53Tg5vfjC/?ref=app

3rd Dec 2020, 10:24 AM
Piyush
Piyush - avatar
5 Answers
+ 8
Piyush Thourani there are many ways if u want a easy way then u can an if statement (ch>64 && ch<91)||(ch>96 && ch<123) Like this here special characters and numbers are not included there's a short method too... String[] n = sc.nextLine().replaceAll("[^a-zA-Z .]", "").split(" ");
3rd Dec 2020, 11:50 AM
Atul
Atul - avatar
+ 7
Thanku so much 😁
3rd Dec 2020, 4:59 PM
Piyush
Piyush - avatar
+ 4
You didn't remove all punctuation from the input first.
3rd Dec 2020, 10:40 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
ChaoticDawg How can I remove punctuation please explain
3rd Dec 2020, 11:39 AM
Piyush
Piyush - avatar
- 1
ظاسقمشبننشبذبنؤنننءب
5th Dec 2020, 8:57 AM
نرجس المغرورة
نرجس المغرورة - avatar