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 ConsoleApplication6
- {
- class Program
- {
- static void Main(string[] args)
- {
- string inputFirst = Console.ReadLine();
- string inputSecond = Console.ReadLine();
- string[] arrayFirst = inputFirst.Split(' ');
- string[] arraySecond = inputSecond.Split(' ');
- List<int> final = new List<int>();
- int counter = 0;
- for (int i = 0; i < arrayFirst.Length; i++)
- {
- final.Add(int.Parse(arrayFirst[i]));
- counter++;
- }
- for (int i = 0; i < arraySecond.Length; i++)
- {
- final.Add(int.Parse(arraySecond[i]));
- counter++;
- }
- final.Sort();
- bool b = false;
- while (b != true)
- {
- b = true;
- int p = 0;
- for (int i = 0; i < counter - 1; i++)
- {
- if (final[i] == final[i + 1])
- {
- final.RemoveAt(i);
- counter--;
- }
- p = counter;
- }
- for (int j = 0; j < p - 1; j++)
- {
- if (final[j] == final[j + 1])
- {
- b = false;
- }
- }
- }
- foreach (var item in final)
- {
- Console.Write(item + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment