Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int a, b, Q;
  8. std::string text;
  9. getline(std::cin, text);
  10. ios_base::sync_with_stdio(false);
  11. cin.tie(NULL);
  12. std::cin >> Q;
  13. for (int i = 0; i < Q; i++) {
  14. std::cin >> a >> b;
  15. for (int j = a - 1; j < b; j++) {
  16. if (isupper(text[j])) {
  17. text[j] = tolower(text[j]);
  18. }
  19. else {
  20. text[j] = toupper(text[j]);
  21. }
  22. }
  23. }
  24. std::cout << text;
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement