#include <iostream>
#include <string>
#include <locale>
#include <cctype>
std::string convertString(std::string s)
{
for(std::string::iterator it = s.begin(); it != s.end(); ++it)
{
if (isupper(*it)) *it = tolower(*it);
else if(islower(*it)) *it = toupper(*it);
else if(isdigit(*it))
{
//write code here...
}
}
return s;
}
int main()
{
std::cout << "Input string to convert: " << std::flush;
std::string toconvert;
std::getline(std::cin, toconvert);
std::cout << "Converted string: " << convertString(toconvert) << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8bG9jYWxlPgojaW5jbHVkZSA8Y2N0eXBlPgoKc3RkOjpzdHJpbmcgY29udmVydFN0cmluZyhzdGQ6OnN0cmluZyBzKQp7CiAgICBmb3Ioc3RkOjpzdHJpbmc6Oml0ZXJhdG9yIGl0ID0gcy5iZWdpbigpOyBpdCAhPSBzLmVuZCgpOyArK2l0KQogICAgewogICAgICAgIGlmICAgICAoaXN1cHBlcigqaXQpKSAqaXQgPSB0b2xvd2VyKCppdCk7CiAgICAgICAgZWxzZSBpZihpc2xvd2VyKCppdCkpICppdCA9IHRvdXBwZXIoKml0KTsKICAgICAgICBlbHNlIGlmKGlzZGlnaXQoKml0KSkKICAgICAgICB7CiAgICAgICAgICAgIC8vd3JpdGUgY29kZSBoZXJlLi4uCiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIHM7Cn0KCmludCBtYWluKCkKewogICAgc3RkOjpjb3V0IDw8ICJJbnB1dCBzdHJpbmcgdG8gY29udmVydDogIiA8PCBzdGQ6OmZsdXNoOwogICAgc3RkOjpzdHJpbmcgdG9jb252ZXJ0OwogICAgc3RkOjpnZXRsaW5lKHN0ZDo6Y2luLCB0b2NvbnZlcnQpOwogICAgc3RkOjpjb3V0IDw8ICJDb252ZXJ0ZWQgc3RyaW5nOiAiIDw8IGNvbnZlcnRTdHJpbmcodG9jb252ZXJ0KSA8PCBzdGQ6OmVuZGw7Cn0=