-
[SWEA-11856] 반반 - Java공부/SWEA 2022. 6. 21. 16:46728x90
https://swexpertacademy.com/main/code/problem/problemDetail.do
SWEA 11856번 반반 자바 풀이
난이도: D3
코드
import java.util.Scanner;public class swea11856 {public static void main(String args[]) throws Exception{Scanner sc = new Scanner(System.in);int T;T=sc.nextInt();for(int test_case = 1; test_case <= T; test_case++){char ch[]=new char[4];String str=sc.next();int result=0;for(int i=0;i<4;i++){ch[i]=str.charAt(i);}for(int i=0;i<4;i++){int count=0;for(int j=0;j<4;j++){if(ch[i]==ch[j]){count++;}}if(count==2){result+=1;}}if(result==4){System.out.println("#"+test_case+" Yes");}else{System.out.println("#"+test_case+" No");}}}}728x90반응형'공부 > SWEA' 카테고리의 다른 글
[SWEA-10912] 외로운 문자 - Java (0) 2022.07.23 [SWEA-11736] 평범한 숫자 - Java (0) 2022.06.22 [SWEA-12004] 구구단1 - Java (0) 2022.06.20 [SWEA-12221] 구구단2 - Java (0) 2022.06.17 [SWEA-12368] 24시간 - Java (0) 2022.06.16