[백준/Java] 2744 : 대소문자 바꾸기

SEOP·2024년 6월 13일
0

import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new BufferedReader(new InputStreamReader(System.in)));
        BufferedWriter bw = new BufferedWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        char[] chars = br.readLine().toCharArray();

        for (char ch : chars) {
            if( Character.isUpperCase(ch) ){
                ch = Character.toLowerCase(ch);
            } else if( Character.isLowerCase(ch) ){
                ch = Character.toUpperCase(ch);
            }
            bw.write(ch);
        }

        bw.flush();
        bw.close();
    }
}
profile
응애 나 애기 개발자

0개의 댓글