10018 - Toggling Cases
#include <cctype> #include <iostream> #include <string> using namespace std; void Slove(string str) { for (int i=0; i<str.length(); ++i) if ( isupper(str[i]) ) str[i]=tolower(str[i]); else if ( islower(str[i]) ) str[i]=toupper(str[i]); cout << str << endl; } int main(void) { string str; getline(cin,str); Slove(str); return 0; }
ctype.hを使いたかっただけです。