eolymp
bolt
Try our new interface for solving problems
Problems

Domino

Domino

You and your friends agreed to play "Among Us". At the appointed time, everyone entered the game. Everyone except Arseniy, who, as always, is late. Being in the waiting room, you decided to play a virtual domino game, which was added in experimental mode in the latest game update. Since the mode is still experimental, the game is as primitive as possible: there are two dominoes on the table. Each domino is a rectangle divided into two halves. Each half of the domino contains from zero to six dots. Players need to determine if these two dominoes can be combined. Dominoes can be matched if and only if there exists a non-negative integer $k$ such that exactly $k$ dots are drawn on at least one of the halves of each domino. This game seemed too primitive to you, so you decided to write a program that will automatically win it. Do it! \InputFile Consists of two lines, each of which contains a description of the domino. The description of a domino consists of several dots (character \textbf{"."}, ASCII code $46$) and exactly one vertical bar (character \textbf{"|"}, ASCII code $124$) . The dots on one side of the vertical line lie in one half of the domino, and on the other --- in the second half. It is guaranteed that each half of each domino contains from $0$ to $6$ dots. \OutputFile Print \textbf{"Yes"} if the dominoes can be combined, and \textbf{"No"} otherwise.
Time limit 1 second
Memory limit 128 MiB
Input example #1
..|....
....|...
Output example #1
Yes
Input example #2
.|...
..|....
Output example #2
No
Input example #3
|
|
Output example #3
Yes
Source 2020 Cycle of Internet Olympiads for schoolchildren, Second team contest, October 25, Problem D