Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class Program
- {
- static void Main()
- {
- string [] inp = Console.ReadLine().Split('\\');
- char [] FirstArr = new char [inp[0].Length];
- char[] SecondArr = new char[inp[1].Length];
- List<char> Output = new List<char>();
- string word = "";
- string command = inp[2];
- string firstWord = inp[0];
- string SecondWord = inp[1];
- for (int i = 0; i < firstWord.Length; i++)
- {
- FirstArr[i] = firstWord[i];
- }
- for (int i = 0; i < SecondWord.Length; i++)
- {
- SecondArr[i] = SecondWord[i];
- }
- if (command =="join")
- {
- for (int i = 0; i < FirstArr.Length; i++)
- {
- for (int j = 0; j < SecondArr.Length; j++)
- {
- if (FirstArr[i] ==SecondArr[j])
- {
- word += FirstArr[i];
- }
- }
- }
- }
- if (command == "right exclude")
- {
- for (int i = 0; i < FirstArr.Length; i++)
- {
- for (int j = 0; j < SecondArr.Length; j++)
- {
- if (FirstArr[i] == SecondArr[j])
- {
- break;
- }
- else if (j == SecondArr.Length - 1)
- {
- word += FirstArr[i];
- }
- }
- }
- }
- if (command == "left exclude")
- {
- for (int i = 0; i < SecondArr.Length; i++)
- {
- for (int j = 0; j < FirstArr.Length; j++)
- {
- if (SecondArr[i] == FirstArr[j])
- {
- break;
- }
- else if (j == FirstArr.Length - 1)
- {
- word+= "" + SecondArr[i];
- }
- }
- }
- }
- char[] result = word.ToCharArray();
- Array.Sort<char>(result);
- foreach (var item in result)
- {
- Console.Write(item);
- }
- }
- private static void printArr(List<char> FirstArr)
- {
- foreach (var item in FirstArr)
- {
- Console.WriteLine(item);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement