Please help me with the task: Pig Latin

Hello, I’m working on this task:

To open the cage and save the captive, you need to enter the code phrase in a simplified Pig Latin language. Infinity is working hard to find the code phrase; your job is to write a converter for English to Pig Latin. In the Main method, read a string from the console, treating a space as a word separator. Output this string in simplified Pig Latin. Ignore double spaces. The code phrase contains only lower case letters.
English is translated to a simplified Pig Latin by taking the first letter of every word, moving it to the end of the word, and adding “ay”. For example:
>the quick brown fox
hetay uickqay rownbay oxfay

Here is my code:


namespace Null
{
   class PigLatin
   {
       public static void Main()
       {
           string codePhrase = Console.ReadLine();

           string[] words = codePhrase.Split(' ');

           foreach (string word in words)
           {
               List<char> letters = new(word);

               char firstLetter = letters[0];

               letters.RemoveAt(0);

               letters.Add(firstLetter);
               letters.Add('a');
               letters.Add('y');

               string newWord = string.Join("", letters);
               

               Console.Write(newWord + " ");

           }

       }
   }
}

Can anyone please help me to solve it?

1.) in order to use List, you have to add a library using Lists. In the top of the file you should have:

using System;
using System.Collections.Generic;

is not working. In order to introduce a List and populate it, you should rather use:

 new List<char>(word);

The rest is fine :slight_smile:

Thanks a lot! About the library - I would never have found it without help) :heart_eyes: