Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- namespace TextFilter_4
- {
- class TextFilter_4
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string[] bannedWords = Regex.Split(input, @"[, ]+");
- string text = Console.ReadLine();
- foreach (var p in bannedWords)
- {
- Regex word = new Regex("\\b" + p.ToString() + "\\b");
- text = word.Replace(text, delegate(Match match)
- {
- string forRemoving = match.ToString();
- return new string('*', forRemoving.Length);
- });
- }
- Console.WriteLine(text);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement