1097A - Gennady and Card Game

 

 문제

 테이블 위에 한 장, 손에는 다섯 장의 카드를 가지고 있을 때 테이블의 카드와 일치하는 문양 혹은 숫자가 있다면 YES, 없으면 NO 출력.


 INPUT 테이블 위의 카드 한장과 손에 들고 있는 카드 다섯 장

 OUTPUT YES or NO

 

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
 * Gennady and Card Game
 * 
 * 
 * @author codenbike
 * @date 2019.12.12
 */
 
import java.util.*;
 
public class Gennady {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String play[] = new String[5];
        int count = 0;
        
        String card = sc.nextLine();
        
        for(int i=0; i<5; i++){
            play[i] = sc.next();
        }
        
        for(int i=0; i<play.length; i++) {
            if(card.charAt(0== play[i].charAt(0|| card.charAt(1== play[i].charAt(1)){
                count++;
            }
        }
        
        if(count == 0){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
}
 

 

 

 

 

 denote 조짐을 보여주다

+ Recent posts