+ 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); } } }
1 Réponse
+ 2
Joseph Oritseweyinmi You have to count average of word length not number of words.
avg = (total_number_of_character) / no_of_words