Advertisement
GogoK

asd

May 14th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. class TextFilter
  7. {
  8.     static void Main()
  9.     {
  10.         List<string> banWords = Convert.ToString(Console.ReadLine()).Split(',').Select(x => x.Trim()).ToList();
  11.         StringBuilder censored = new StringBuilder(GetText());
  12.        
  13.         for (int i = 0; i < banWords.Count; i++)
  14.         {
  15.             int length = banWords[i].Length;
  16.             string stars = new string('*', length);
  17.             censored.Replace(banWords[i], stars);
  18.         }
  19.         Console.WriteLine(censored);
  20.     }
  21.  
  22.     static string GetText()
  23.     {
  24.         //string newText = Console.ReadLine();
  25.         string newText = "It is not Linux, it is GNU/Linux. Linux is merely the kernel, while GNU adds the functionality. Therefore we owe it to them by calling the OS GNU/Linux! Sincerely, a Windows client";
  26.         return newText;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement