Advertisement
Guest User

RemoveNames

a guest
Apr 9th, 2014
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace _9_RemoveNames
  5. {
  6.     class RemoveNames
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             var names = Console.ReadLine().Split(new char[] {' '},
  11.                 StringSplitOptions.RemoveEmptyEntries);
  12.             var namesToRemove = Console.ReadLine().Split(new char[] { ' ' },
  13.                 StringSplitOptions.RemoveEmptyEntries);
  14.  
  15.             var namesToDisplay = names.Where(n => !namesToRemove.Contains(n));
  16.             foreach (var name in namesToDisplay)
  17.             {
  18.                 Console.Write(name+" ");
  19.             }
  20.             Console.WriteLine();
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement