Advertisement
Guest User

withToLower

a guest
Jun 22nd, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Globalization;
  6. using System.Numerics;
  7.  
  8. namespace SoftUni
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. string input = Console.ReadLine().ToLower();
  15. string pattern = Console.ReadLine().ToLower();
  16. int firstIndex = 0;
  17. int lastIndex = 0;
  18. while (true)
  19. {
  20. firstIndex = input.IndexOf(pattern);
  21. lastIndex = input.LastIndexOf(pattern);
  22. if (firstIndex != -1 && lastIndex != -1 && pattern.Length > 0)
  23. {
  24.  
  25. input = input.Remove(lastIndex, pattern.Length);
  26. input = input.Remove(firstIndex, pattern.Length);
  27.  
  28. Console.WriteLine("Shaked it.");
  29.  
  30. pattern = pattern.Remove(pattern.Length / 2, 1);
  31. }
  32. else
  33. {
  34. Console.WriteLine("No shake.");
  35. Console.WriteLine(input);
  36. break;
  37. }
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement