공부/SWEA

[SWEA-2050] 알파벳을 숫자로 변환 - Java

빈v 2022. 5. 30. 18:00
728x90

https://swexpertacademy.com/main/code/problem/problemDetail.do

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

SWEA 2050 알파벳을 숫자로 변환 자바 풀이

 

 
import java.util.Scanner;
public class swea2050 {
    public static void main(String args[]) throws Exception
    {
        Scanner sc = new Scanner(System.in);
        String str=sc.nextLine();
        for(int i=0;i<str.length();i++){
            System.out.print(str.charAt(i)-'A'+1+" ");
        }
    }
}
728x90
반응형