-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlaying_Cards.java
More file actions
41 lines (39 loc) · 897 Bytes
/
Playing_Cards.java
File metadata and controls
41 lines (39 loc) · 897 Bytes
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
38
39
40
41
import java.io.*;
import java.lang.*;
import java.util.*;
public class Playing_Cards
{
public static void main(String[] args)
{
//write your code here
Scanner sc=new Scanner(System.in);
String str1=sc.next();
//int flag=0;
String str2[]=new String[5];
for(int i=0;i<str2.length;i++)
{
str2[i]=sc.next();
}
int flag=0;
for(int i=0;i<str2.length;i++)
{
if(str1.charAt(0)==str2[i].charAt(0))
{
flag=1;
break;
}
if(str1.charAt(1)==str2[i].charAt(1))
{
flag=1;
}
}
if(flag==1)
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
}