So the task is that I have to code a program that lets the user enter text. After that, I have to filter the text for non-capital letters only and put them in a list. Every letter should only be in the list once. My code's problem is that when I enter a word like "even", the method selects out e and v but the method doesn't skip the second "e" and ends there.
for (int i = 0; i < text.Length; i++)
{
if (letters.Contains(text[i]) == false && (text[i] >= 'a' && text[i] <= 'z'))
{
letters.Add(text[i]);
Console.WriteLine($"{letters[i]}");
}
}
I get an index out of range error message.