Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _09.MelrahShake
- {
- public class MelrahShake
- {
- public static void Main()
- {
- string input = Console.ReadLine();
- string pattern = Console.ReadLine();
- int idex = -1;
- string changedInput = string.Empty;
- while (pattern.Length > 0 && input.Length > 0)
- {
- idex = input.IndexOf(pattern, idex + 1);
- if (idex == -1)
- {
- break;
- }
- else
- {
- Console.WriteLine("Shaked it.");
- changedInput = input.Replace(pattern, "");
- pattern = pattern.Remove(pattern.Length / 2, 1);
- input = changedInput;
- }
- }
- Console.WriteLine("No shake.");
- Console.WriteLine(changedInput);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement