/* This program reads a string from standard input, and then changes its characters by switching upper and lower-case letters. */ #include using namespace std; int main() { string s; size_t i; if (cin >> s) { for (i = 0; i < s.size(); i++) { if (s[i] >= 'A' && s[i] <= 'Z') { // If upper-case, change to lower-case s[i] += ('a'-'A'); } else if (s[i] >= 'a' && s[i] <= 'z') { // If lower-case, change to upper-case s[i] += ('A'-'a'); } } cout << "Swapped upper and lower-case: " << s << "." << endl; } return 0; }