30 lines
588 B
Java
30 lines
588 B
Java
package chelper;
|
|
|
|
import io.InputReader;
|
|
import io.OutputWriter;
|
|
import solutions.ChelperSolution;
|
|
|
|
|
|
public class TaskA extends ChelperSolution {
|
|
|
|
@Override
|
|
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
|
super.solve(testNumber, in, out);
|
|
}
|
|
|
|
@Override
|
|
public void solve(int testNumber) {
|
|
String hand = in.nextString();
|
|
|
|
boolean ok = false;
|
|
for (int i = 0; i < 5; i++) {
|
|
String s = in.nextString();
|
|
|
|
ok |= s.charAt(0) == hand.charAt(0);
|
|
ok |= s.charAt(1) == hand.charAt(1);
|
|
}
|
|
|
|
out.println(ok ? "YES" : "NO");
|
|
}
|
|
}
|