Hi i have a error in my program; can anyone help? the error is in line: word = wordList.Trim(); "Index was outside the bounds of the array " -------------------------------------------------------------- Code: using System; using System.Collections.Generic; using System.Text; namespace Assignment4 { class WordCount { static void Main(string[] args) { string sentence; string[] wordList; string word; int[] sizeCount = new int[6]; int i; int characterCount = 0; string runAgain; bool continueRunning = true; Console.WriteLine("The program will analyse sentences you type in."); while (continueRunning == true) { for (i = 0; i <= 5; i++) { sizeCount[i] = 0; } Console.WriteLine(); Console.Write("Please enter a sentence: "); sentence = Console.ReadLine(); while (sentence.Length == 0) { Console.Write("You must enter some text. Please try again: "); sentence = Console.ReadLine(); } Console.WriteLine(); wordList = sentence.Split(new char[] { ' ' }); Console.WriteLine("The number of words in the sentence is " + wordList.Length); for (i = 0; i <= wordList.Length; i++) { word = wordList[i].Trim(); if (word.Length > 0) { if (word.Length > 5) { sizeCount[0]++; } else { sizeCount[word.Length]++; } characterCount = characterCount + word.Length; } } Console.WriteLine("The number of words with 1 letter is " + sizeCount[1]); for (i = 1; i <= 5; i++) { Console.WriteLine("The number of words with " + i + " letters is " + sizeCount[i]); } Console.WriteLine("The number of words with 6 or more letters is " + sizeCount[0]); Console.WriteLine("The number of non-white space characters is " + characterCount); Console.WriteLine(); Console.Write("Do you want to analyse another sentence (Y/N)? "); runAgain = Console.ReadLine().ToUpper(); while (runAgain != "Y" && runAgain != "N") { Console.Write("Please enter Y or N: "); runAgain = Console.ReadLine().ToUpper(); } if (runAgain == "Y") { continueRunning = false; } } } } }