Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _04.Array_Matcher
- {
- class Array_Matcher
- {
- static void Main(string[] args)
- {
- string[] array = Console.ReadLine().Split('\\');
- string[] newArray = new string[array.Length];
- char[] array1 = array[0].ToCharArray();
- char[] array2 = array[1].ToCharArray();
- List<char> result = new List<char>();
- for (int i = 0; i < array.Length-1; i++)
- {
- if (array[2] == "join")
- {
- foreach (var item in array1)
- {
- if (array2.Contains(item))
- {
- result.Add(item);
- }
- }
- }
- else if (array[2]== "left exclude")
- {
- foreach (var item in array2)
- {
- if (!array1.Contains(item))
- {
- result.Add(item);
- }
- }
- }
- else
- {
- foreach (var item in array1)
- {
- if (!array2.Contains(item))
- {
- result.Add(item);
- }
- }
- }
- }
- result.Sort();
- Console.WriteLine(string.Join("", result.Distinct()));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement