공부/SWEA

[SWEA-8741] 두문자어 - Java

빈v 2022. 8. 15. 19:51
728x90

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

 

SW Expert Academy

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

swexpertacademy.com

 

SWEA 8741번 두문자어 자바 풀이

난이도: D3

 

코드

import java.util.Scanner;
public class swea8741 {
    public static void main(String args[]) throws Exception
    {
        Scanner sc = new Scanner(System.in);
        int T;
        T=sc.nextInt();
        sc.nextLine();
        for(int test_case = 1; test_case <= T; test_case++)
        {
            String str=sc.nextLine();
            String str1[]=str.split(" ");
            String ans="";
           
            for(int i=0;i<str1.length;i++){
                  ans+=str1[i].substring(0,1);
            }
            String ans2=ans.toUpperCase();
            System.out.println("#"+test_case+" "+ans2);
        }
    }
}
728x90
반응형