Advertisement
Razhagal

Remove Names

Mar 31st, 2014
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class RemoveNames
  8. {
  9.     static void Main()
  10.     {
  11.         string firstInputLine = Console.ReadLine();
  12.         string[] firstNames = firstInputLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  13.         string secondInputLine = Console.ReadLine();
  14.         string[] secondNames = secondInputLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  15.  
  16.         List<string> firstLine = firstNames.ToList<string>();
  17.         List<string> secondLine = secondNames.ToList<string>();
  18.  
  19.         for (int i = 0; i < secondLine.Count; i++)
  20.         {
  21.             for (int j = 0; j < firstLine.Count; j++)
  22.             {
  23.                 if (firstLine.Contains(secondLine[i]))
  24.                 {
  25.                     firstLine.Remove(secondLine[i]);
  26.                 }
  27.             }
  28.         }
  29.  
  30.         foreach (var item in firstLine)
  31.         {
  32.             Console.Write(item + " ");
  33.         }
  34.         Console.WriteLine();
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement