Write longest and shortest palindrom from text file : i am trying to write a program what will write longest and shortest palindrom from words in text file. My code looks like this now:


        static void Main(string[] args)
        {
            string[] lines = System.IO.File.ReadAllLines(@"C:\palindromy.txt");
            
            foreach (string line in lines)
            {
                char[] charArray = line.ToCharArray();
                for (int i = 0; i < 1; i++)
                {
                    Array.Reverse(charArray);
                    bool a = charArray.SequenceEqual(line);
                    while(a == true)
                    {                        
                        Console.WriteLine(line); /that will just write all palindroms
                        break;
                    }
                }
            }
        }
    

I am curently just writing all palindroms, but i need to write just longest and shortest one.