Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- namespace Advanced
- {
- class Program
- {
- static void Main(string[] args)
- {
- var firstSet = new HashSet<string>();
- var secondSet = new HashSet<string>();
- var setsSize = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToArray();
- for (int i = 0; i < setsSize.Sum(); i++)
- {
- var element = Console.ReadLine();
- if (i < setsSize[0])
- {
- firstSet.Add(element);
- }
- else
- {
- secondSet.Add(element);
- }
- }
- Console.WriteLine(string.Join(" ", firstSet.Where(x => secondSet.Contains(x))));
- }
- }
- }
Add Comment
Please, Sign In to add comment