MapleStory Finger Point

๐Ÿƒ‍โ™‚๏ธBaekjoon/Java

#2744 - ๋Œ€์†Œ๋ฌธ์ž java

HYEJU01 2024. 4. 19. 07:59
import java.util.*;

public class Main {
    public static void main(String[] args)  {
    	
    	Scanner sc = new Scanner(System.in);
    	
    	String S = sc.nextLine();
    	
    	for (int i =0; i<S.length(); i++) {
    		char c = S.charAt(i);
    		if (Character.isLowerCase(c)) {
    			c = Character.toUpperCase(c);
    		}
    		else if (Character.isUpperCase(c)) {
    			c = Character.toLowerCase(c);
    		}
    		System.out.print(c);
    	}
    	
		
		}
    }

๋Œ€์†Œ๋ฌธ์ž ๋ฐ”๊พธ๊ธฐ

 

๐Ÿ’ฌ Character.isUpperCase(ch) ๋Œ€๋ฌธ์ž์ธ์ง€ ํ™•์ธ ,

๐Ÿ’ฌ  Character.toLowerCase(ch) ์†Œ๋ฌธ์ž๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค. 

๐Ÿ’ฌ charAt ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฌธ์ž์—ด์˜ ๊ฐ ๋ฌธ์ž๋ฅผ ๊ฐ€์ ธ์˜ค๊ณ  ํŠน์ • ์ธ๋ฑ์Šค ์œ„์น˜์˜ ๋ฌธ์ž๋ฅผ ์ถœ๋ ฅ