Advertisement
StoyanGrigorov

Untitled

Oct 18th, 2016
125
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. using System.Threading.Tasks;
  6. //09. Melrah Shake
  7. namespace MelrahShake
  8. {
  9.     class MelrahShake
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string input = Console.ReadLine().Trim();
  14.             string pattern = Console.ReadLine();
  15.  
  16.             bool canShake = true;
  17.  
  18.             while (canShake)
  19.             {
  20.                 if (input.Contains(pattern))
  21.                 {
  22.                     input = input.Replace(pattern, "");
  23.                     Console.WriteLine("Shaked it.");
  24.                     pattern = pattern.Remove(pattern.Length / 2,1);
  25.                 }
  26.                 else
  27.                 {
  28.                     Console.WriteLine("No shake.");
  29.                     canShake = false;
  30.                 }
  31.             }
  32.             Console.WriteLine(input);
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement