Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ExamPreparation
- {
- public sealed class Preparation
- {
- public static void Main()
- {
- string input = Console.ReadLine();
- string key = Console.ReadLine();
- while (true)
- {
- int firstIndex = input.IndexOf(key);
- int lastIndex = input.LastIndexOf(key);
- if (firstIndex == -1 || lastIndex == -1 || firstIndex == lastIndex || key.Length == 0)
- {
- Console.WriteLine("No shake.");
- Console.WriteLine(input);
- break;
- }
- input = input.Remove(lastIndex, key.Length);
- input = input.Remove(firstIndex, key.Length);
- key = key.Remove(key.Length / 2, 1);
- Console.WriteLine("Shaked it.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment