using System;
using System.Collections.Generic;
class Program {
static void Main() {
// Write your C# code here
Console.WriteLine("Hello, World!");
List<string>ShoppingList=new List<string>{
"COFFEE","MILK","TEA"
};
Console.WriteLine(" enter string to search ");
string search=Console.ReadLine();
if(FindInList(search,ShoppingList,out int index)){
Console.WriteLine($"Found {search} at {index}");
}else{
Console.WriteLine("not found");
}
}
static bool FindInList(string item, List<string> list, out int index) {
for (int i = 0; i < list.Count; i++) {
if (string.Equals(list[i], item, StringComparison.OrdinalIgnoreCase)) {
index = i;
return true;
}
}
index = -1;
return false;
}
}