Advertisement
Aborigenius

TextFilterBannedWords

Aug 22nd, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 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. namespace MiniLab
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string[] banned = Console.ReadLine().Split(new string []{", " }, StringSplitOptions.RemoveEmptyEntries);
  14.             string text = Console.ReadLine();
  15.  
  16.             foreach (var ban in banned)
  17.             {
  18.                 if (text.Contains(ban))
  19.                 {
  20.                     text = text.Replace(ban, new string ('*',ban.Length));
  21.                 }
  22.             }
  23.             Console.WriteLine(text);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement