My code got 2 out of five test cases in the average word length challenge. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

My code got 2 out of five test cases in the average word length challenge.

Please can someone help me this : using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Text.RegularExpressions; namespace SoloLearn { class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(); int count = 0; foreach (string n in input) { if (n != " ") count++; } Console.WriteLine(count - 2); } } }

11th May 2020, 7:33 AM
Joseph Oritseweyinmi
Joseph Oritseweyinmi - avatar
1 Answer
+ 2
Joseph Oritseweyinmi You have to count average of word length not number of words. avg = (total_number_of_character) / no_of_words
11th May 2020, 7:39 AM
A͢J
A͢J - avatar