-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoveNames.cs
More file actions
37 lines (35 loc) · 1.05 KB
/
Copy pathRemoveNames.cs
File metadata and controls
37 lines (35 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RemoveNames
{
class RemoveNames
{
static void Main()
{
Console.Write("enter main list: ");
string mainList = Console.ReadLine();
Console.Write("enter replace list: ");
string replaceList = Console.ReadLine();
List<string> firstList = new List<string>(mainList.Split());
List<string> secondList = new List<string>(replaceList.Split());
foreach (var item in secondList)
{
for (int i = 0; i < firstList.Count; i++)
{
if (item == firstList[i])
{
firstList.RemoveAt(i); i--;
}
}
}
foreach (var item in firstList)
{
Console.Write(item + " ");
}
Console.WriteLine();
}
}
}