소문자는 대문자로 대문자는 소문자로

Seung jun Cha·2023년 1월 13일
0

- 아스키코드 또는 Character.isLowerCase(), isupperCase() 사용

public class Main {


    public String solution(String next) {


        String result ="";

        for (char x :
                next.toCharArray()) {
            if (x >= 'a' && x <= 'z'){
                result += Character.toUpperCase(x);
            }else {
                result += Character.toLowerCase(x);
            }
        }
        return result;
    }

    public static void main(String[] args) {

        Main T = new Main();
        Scanner sc = new Scanner(System.in);
        String next = sc.next();


        System.out.println(T.solution(next));
    }

0개의 댓글