SWEA
[SWEA] 2047. ์ ๋ฌธ ํค๋๋ผ์ธ
JulesJ
2022. 5. 17. 02:32
728x90
2047. ์ ๋ฌธ ํค๋๋ผ์ธ - D1
์์คํค์ฝ๋๋ฅผ ์ด์ฉํด์ ์๋ฌธ์๋ฅผ ๋๋ฌธ์๋ก ๋ฐ๊ฟ์ค ์ ์๋ if๋ฌธ์ ์ด์ฉํ๋ค.
์๋ฌธ์ a๊ฐ 97์ด๋ผ 97๋ณด๋ค ํฌ๊ฑฐ๋ ๊ฐ์ ๊ฒฝ์ฐ a์ A - ์ํ๋ฒณ ๋์๋ฌธ์ ์ฐจ์ด๋งํผ ๋นผ์คฌ๋ค.
ํ์ง๋ง ์๋ฐ๋.. ๊ฐ๋จํ๊ฒ ๋ฐ๋ก ์ด์ฉํ ์ ์๋ ํจ์๋ฅผ ์ ๊ณต ์ค์ด๋ผ ๊ทธ๊ฑธ๋ก๋ ํ์ด๋ณด์๋ค..
import java.util.Scanner;
import java.io.FileInputStream;
class Solution
{
public static void main(String args[]) throws Exception
{
Scanner sc = new Scanner(System.in);
String sentense = sc.next();
for(int i = 0; i < sentense.length(); i++)
{
char s = sentense.charAt(i);
if((int)s >= 97){
System.out.print((char)(s-32));
}else{
System.out.print(s);
}
}
}
}
String์ toUpperCase ํจ์๋ฅผ ์ด์ฉํ๋ฉด ์์ ๋ช์ค์ ํ ์ค๋ก ์ค์ผ ์ ์๋ค..!
import java.util.Scanner;
import java.io.FileInputStream;
class Solution
{
public static void main(String args[]) throws Exception
{
Scanner sc = new Scanner(System.in);
String sentense = sc.next();
System.out.println(sentense.toUpperCase());
}
}
๋ ๐ง
728x90