Advertisement
Teodor92

ForbiddenWords.cs

Jan 24th, 2013
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using System;
  2.  
  3. public class ForbiddenWords
  4. {
  5.     public static void Main()
  6.     {
  7.         string textInput = Console.ReadLine();
  8.         string[] forbidenWords = "PHP, CLR, Microsoft".Split(',');
  9.         for (int i = 0; i < forbidenWords.Length; i++)
  10.         {
  11.             forbidenWords[i] = forbidenWords[i].Trim();
  12.             textInput = textInput.Replace(forbidenWords[i], new string('*', forbidenWords[i].Length));
  13.         }
  14.  
  15.         Console.WriteLine(textInput);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement