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 ArrayMatcher
- {
- class ArrayMatcher
- {
- static void Main(string[] args)
- {
- string inputDate = Console.ReadLine();
- string[] date = inputDate.Split('\\');
- char[] leftArray = date[0].ToCharArray();
- char[] rightArray = date[1].ToArray();
- List<char> output = new List<char>();
- int flag = 0;
- if (date[2] == "join")
- {
- for (int i = 0; i < rightArray.Length; i++)
- {
- for (int j = 0; j < leftArray.Length; j++)
- {
- if (leftArray[j] == rightArray[i])
- {
- output.Add(leftArray[j]);
- }
- }
- }
- }
- else if (date[2] == "left exclude")
- {
- for (int i = 0; i < rightArray.Length; i++)
- {
- for (int j = 0; j < leftArray.Length; j++)
- {
- if (rightArray[i] == leftArray[j])
- {
- flag++;
- }
- }
- if(flag==0)output.Add(rightArray[i]);
- flag = 0;
- }
- }
- else if (date[2] == "right exclude")
- {
- for (int i = 0; i < leftArray.Length; i++)
- {
- for (int j = 0; j < rightArray.Length; j++)
- {
- if (leftArray[i] == rightArray[j])
- {
- flag++;
- }
- }
- if (flag == 0) output.Add(leftArray[i]);
- flag = 0;
- }
- }
- output.Sort();
- string outputString = string.Join("", output);
- Console.WriteLine(outputString);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement