Notice
Recent Posts
Recent Comments
Link
할껀하고놀자
[백준] 2744번 대소문자 바꾸기 본문
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

'[IT] > 백준' 카테고리의 다른 글
[백준] 1010번 다리놓기 (0) | 2019.09.28 |
---|---|
[백준] 11179번 2진수 뒤집기 (C++, python3) (0) | 2019.09.21 |
[백준] 1789번 수들의 합 (0) | 2019.09.21 |
[백준] 11653번 소인수분해 - (파이썬,C++ 속도차 실화냐..) (0) | 2019.09.21 |
[백준] 2530번 인공지능 시계 (0) | 2019.09.21 |