Advertisement
alexbancheva

Text_Filter_Lab_TextProcessing

Sep 13th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Text_Filter_Lab_TextProcessing
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string[] banWords = Console.ReadLine()
  11.                 .Split(", ");
  12.             string text = Console.ReadLine();
  13.  
  14.             foreach (var banWord in banWords)
  15.             {
  16.  
  17.                 if (text.Contains(banWord))
  18.                 {
  19.                     text = text.Replace(banWord, new string('*', banWord.Length));
  20.                 }
  21.  
  22.             }
  23.  
  24.             Console.WriteLine(text);
  25.         }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement