Advertisement
GStepanov

Untitled

Oct 27th, 2017
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 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.  
  7. namespace _09.MelrahShake
  8. {
  9. public class MelrahShake
  10. {
  11. public static void Main()
  12. {
  13. string input = Console.ReadLine();
  14. string pattern = Console.ReadLine();
  15.  
  16. int idex = -1;
  17. string changedInput = string.Empty;
  18. while (pattern.Length > 0 && input.Length > 0)
  19. {
  20. idex = input.IndexOf(pattern, idex + 1);
  21.  
  22. if (idex == -1)
  23. {
  24. break;
  25. }
  26. else
  27. {
  28. Console.WriteLine("Shaked it.");
  29. changedInput = input.Replace(pattern, "");
  30. pattern = pattern.Remove(pattern.Length / 2, 1);
  31. input = changedInput;
  32. }
  33. }
  34. Console.WriteLine("No shake.");
  35. Console.WriteLine(changedInput);
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement