본문 바로가기
C++

[프로그래머스] 대소문자 바꿔서 출력하기

by 띰쥬 2025. 8. 26.
728x90
반응형
SMALL

#include <iostream>
#include <string>

using namespace std;

int main(void) {
    string str;
    cin >> str;
    
    for (auto c : str)
    {
        if (c >= 'a' && c <= 'z')
            c -= 'a' - 'A';
        else
            c += 'a' - 'A';
        
        cout << c;
    }
    
    return 0;
}

728x90
반응형
LIST

댓글