TheBulgarianWolf

String Manipulation

Mar 17th, 2021
573
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace StringManipulation
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string removeWord = Console.ReadLine();
  10.             string text = Console.ReadLine();
  11.  
  12.             int index = text.IndexOf(removeWord);
  13.  
  14.             while(index != -1)
  15.             {
  16.                 text = text.Remove(index, removeWord.Length);
  17.                 index = text.IndexOf(removeWord);
  18.             }
  19.  
  20.             Console.WriteLine(text);
  21.         }
  22.     }
  23. }
  24.  
RAW Paste Data