Advertisement
Guest User

Text Filter

a guest
May 13th, 2015
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class TextFilter
  5. {
  6.     static void Main()
  7.     {
  8.         string[] filter = Console.ReadLine().Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
  9.         string text = Console.ReadLine();
  10.  
  11.         text = filter.Aggregate(text, (current, word) => current.Replace(word, new string('*', word.Length)));
  12.  
  13.         Console.WriteLine(text);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement