Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- /*Hristo Hristo Nakov Nakov Petya
- Nakov Vanessa Maria
- output Hristo Hristo Petya
- */
- class Intersection
- {
- static void Main()
- {
- List<string> listOne = new List<string>(Console.ReadLine().Split(' '));
- List<string> listTwo = new List<string>(Console.ReadLine().Split(' '));
- listOne = IntersectionWord(listOne, listTwo);
- foreach (var i in listOne)
- {
- Console.Write(i + " ");
- }
- Console.WriteLine();
- }
- static List<string> IntersectionWord(List<string> listOne, List<string> listTwo)
- {
- List<string> newL = new List<string>();
- foreach (var i in listOne)
- {
- if(listTwo.Contains(i))
- {
- continue;
- }
- newL.Add(i);
- }
- return newL;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment