Index was outside the bounds of the array
Hi! i need to solve this - how many characters at the beginning of the string are mirrored to those at the end of the string When string is symmetric the index is out of rang, how to solve this? string word = Console.ReadLine(); char lastCharacter = word[word.Length - 1]; char first = word[0]; int count = 0; while (first == lastCharacter ) { if (first == lastCharacter) { count++; lastCharacter = word[word.Length - (count + 1)]; first = word[count]; } } Console.WriteLine(count);