#include <iostream>
#include <string>
#include <cctype>
//using namespace std; // <--- Best not to use.
int main()
{
// ifstream fin("date.in");
std::string str1/*, str2*/;
//int idx; // <--- Should define in the for loop.
std::cout << "\n Enter a string: "; // <--- Change any way you like, but the input needs a prompt.
std::getline(std::cin, str1);
//int n = strlen(str1);
for (size_t idx = 0; idx < str1.size(); idx++)
{
if (std::isupper(str1[idx]))
str1[idx] = std::tolower(str1[idx]);
elseif (std::islower(str1[idx]))
str1[idx] = std::toupper(str1[idx]);
}
std::cout << str1;
return 0; // <--- Not required, but makes a good break point.
}