[IT]/백준
[백준] 2744번 대소문자 바꾸기
working_hard
2019. 9. 21. 16:11
728x90
c++ code
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
string s;
cin >> s;
for (int i = 0; i < s.length(); i++) {
char c = s[i];
if ('a' <= c && c <= 'z') {
s[i] = s[i] - 32;
}
else {
s[i] = s[i] + 32;
}
}
cout << s << '\n';
return 0;
}
파이썬 코드
print(input().swapcase())
result
