Advertisement
Guest User

10JoinLists

a guest
Apr 9th, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. class JoinLists
  6. {
  7.     static void Main()
  8.     {
  9.         string firstLine = Console.ReadLine();
  10.         string secondLine = Console.ReadLine();
  11.  
  12.         string[] firstArray = firstLine.Split(' ');
  13.         string[] secondArray = secondLine.Split(' ');
  14.  
  15.         List<string> firstList = firstArray.ToList<string>();
  16.         List<string> secondList = secondArray.ToList<string>();
  17.  
  18.         List<string> joinedLists = firstList.Union(secondList).ToList<string>();
  19.         joinedLists.Sort();
  20.  
  21.         foreach (var item in joinedLists)
  22.         {
  23.             Console.Write(item + " ");
  24.         }
  25.         Console.WriteLine();
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement