Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3.  
  4. class Program
  5. {
  6.  
  7. static void Main()
  8. {
  9. //variables:
  10. char[] stringS;
  11. string str;
  12. str = Console.ReadLine();
  13.  
  14. stringS = str.ToCharArray();
  15.  
  16. int Q;
  17. Q = Convert.ToInt32(Console.ReadLine());
  18.  
  19. int stop = 2 + Q;
  20.  
  21. for (int i = 2; i < stop; ++i)
  22. {
  23.  
  24. string[] nums_strings = Console.ReadLine().Split();
  25. int[] nums = new int[nums_strings.Length];
  26.  
  27. for (int j = 0; j < nums_strings.Length; j++)
  28. nums[j] = Convert.ToInt32(nums_strings[j]);
  29.  
  30. int L = nums[0];
  31. int R = nums[1];
  32. ReverseCase(stringS, L, R);
  33. }
  34.  
  35. Console.WriteLine(new string(stringS));
  36. }
  37.  
  38. static void ReverseCase(char[] array, int startIndex, int stopIndex)
  39. {
  40. for (int i = startIndex - 1; i < stopIndex; ++i)
  41. {
  42. if (char.IsLower(array[i]))
  43. {
  44. array[i] = char.ToUpper(array[i]);
  45. }
  46. else
  47. {
  48. array[i] = char.ToLower(array[i]);
  49. }
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement