Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Numerics;
- namespace C_
- {
- class Program
- {
- static void Main(string[] args)
- {
- var input = Console.ReadLine();
- string pattern = Console.ReadLine();
- int patternCount = pattern.Length;
- while (true)
- {
- int start = input.IndexOf(pattern);
- int end = input.LastIndexOf(pattern);
- if (start >=0 && end >= 0 && input.Length > pattern.Length)
- {
- string current = null;
- var arr = input.ToCharArray();
- for (int i = 0; i < arr.Length; i++)
- {
- if (i != start && i != end)
- {
- current += input[i];
- }
- else
- {
- i += pattern.Length-1;
- }
- }
- input = current;
- Console.WriteLine("Shaked it.");
- int patternToRemove = pattern.Length / 2;
- if (patternToRemove <= pattern.Length-1)
- {
- pattern.ToCharArray();
- string newPatt = null;
- for (int i = 0; i < pattern.Length; i++)
- {
- if (i == patternToRemove)
- {
- continue;
- }
- else
- {
- newPatt += pattern[i];
- }
- }
- pattern = newPatt;
- if (pattern==null)
- {
- Console.WriteLine("No shake.");
- break;
- }
- }
- }
- else
- {
- Console.WriteLine("No shake.");
- break;
- }
- }
- Console.WriteLine(input);
- }
- }
- }
Add Comment
Please, Sign In to add comment