#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
int main()
{
int i;
string first = "Bart";
string last = "Simpson";
string both = first + " " + last;
// print out the original name first
cout << both << endl;
// invert capitalization (small to big, big to small)
for (i=0; i<both.size(); i++)
if (isupper(both[i]))
both[i] = tolower(both[i]);
else
if (islower(both[i]))
both[i] = toupper(both[i]);
// print the result out
cout << both << endl;
// capitalize each character
for (i=0; i<both.size(); i++)
both[i] = toupper(both[i]);
// print the result out
cout << both << endl;
// make each character lower case
for (i=0; i<both.size(); i++)
both[i] = tolower(both[i]);
// print the result out
cout << both << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Y3R5cGUuaD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpCnsKICBpbnQgaTsKICBzdHJpbmcgZmlyc3QgPSAiQmFydCI7CiAgc3RyaW5nIGxhc3QgPSAiU2ltcHNvbiI7CiAgc3RyaW5nIGJvdGggPSBmaXJzdCArICIgIiArIGxhc3Q7CgogIC8vIHByaW50IG91dCB0aGUgb3JpZ2luYWwgbmFtZSBmaXJzdAoKICBjb3V0IDw8IGJvdGggPDwgZW5kbDsKCiAgLy8gaW52ZXJ0IGNhcGl0YWxpemF0aW9uIChzbWFsbCB0byBiaWcsIGJpZyB0byBzbWFsbCkKCiAgZm9yIChpPTA7IGk8Ym90aC5zaXplKCk7IGkrKykKICAgIGlmIChpc3VwcGVyKGJvdGhbaV0pKQogICAgICBib3RoW2ldID0gdG9sb3dlcihib3RoW2ldKTsKICAgIGVsc2UKICAgICAgaWYgKGlzbG93ZXIoYm90aFtpXSkpCiAgICAgICAgYm90aFtpXSA9IHRvdXBwZXIoYm90aFtpXSk7CgogIC8vIHByaW50IHRoZSByZXN1bHQgb3V0CgogIGNvdXQgPDwgYm90aCA8PCBlbmRsOwoKICAvLyBjYXBpdGFsaXplIGVhY2ggY2hhcmFjdGVyCgogIGZvciAoaT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