Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Diagnostics;
  4.  
  5. namespace huita
  6. {
  7. class Program
  8. {
  9. static void Main()
  10. {
  11.  
  12.  
  13. //variables:
  14. string[] allFilesLines = File.ReadAllLines("input.txt");
  15. char[] stringS = allFilesLines[0].ToCharArray();
  16.  
  17. for (int i = 2; i < allFilesLines.Length; ++i)
  18. {
  19. ReverseCase(stringS, Int32.Parse(allFilesLines[i].Split()[0]), Int32.Parse(allFilesLines[i].Split()[1]));
  20. }
  21.  
  22. File.WriteAllText("output.txt", new string(stringS));
  23.  
  24.  
  25. }
  26.  
  27. static void ReverseCase(char[] array, int startIndex, int stopIndex)
  28. {
  29. for (int i = startIndex - 1; i < stopIndex; ++i)
  30. {
  31. if (char.IsLower(array[i]))
  32. {
  33. array[i] = char.ToUpper(array[i]);
  34. }
  35. else
  36. {
  37. array[i] = char.ToLower(array[i]);
  38. }
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement