Advertisement
Guest User

Untitled

a guest
May 25th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5. const int XL = 100;
  6. int main()
  7. {
  8. int n; cin >> n;
  9.  
  10. char a[XL];
  11. cin >> a;
  12.  
  13.  
  14. int x = a[0];
  15. int y = a[1];
  16.  
  17.  
  18. if(x >= 'A' && x <= 'Z')
  19. {
  20.  
  21. if (y >= 'A' && y <= 'Z')
  22. {
  23.  
  24. for(int i = 0; i < n; i++)
  25. {
  26. a[i] = a[i] + 32;
  27. }
  28. return 0;
  29. }
  30. else
  31. {
  32. cout << a;
  33. return 0;
  34. }
  35.  
  36. }
  37. else if (x >= 'a' && x <= 'z')
  38. {
  39. a[0] = a[0]-32;
  40. if (y >= 'A' && y <= 'Z')
  41. {
  42. for(int i = 1; i < n; i++)
  43. {
  44. a[i] = a[i]+32;
  45. }
  46. }
  47. }
  48.  
  49.  
  50.  
  51.  
  52. for(int i = 0; i < n; i++)
  53. cout << a[i];
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement