Domino
Time limit2sMemory limit1024 MB
Given two domino tiles, the task is to decide whether they share a half with the same number of dots.
- Level
Easy1 of 10
- Topics
- Implementation, String
- Solved
- No attempts yet
Statement
You and your friends agreed to play <>. At the set time, everyone joined the game except Arseniy, who is late as usual. While you wait in the lobby, you decide to play a virtual domino game that was added in the latest update's experimental mode.
Because the mode is still experimental, the game is very simple. Two domino tiles lie on the table. Each tile is a rectangle split into two halves, and each half shows from zero to six dots. Players must decide whether the two tiles can be matched. Two tiles can be matched if and only if there is a non-negative integer such that at least one half of each tile shows exactly dots.
The game seems too simple to you, so you decide to write a program that wins it automatically. Write that program.
Input
The input has two lines, and each line describes one tile. A description consists of several dots (the character ., ASCII code 46) and exactly one vertical bar (the character |, ASCII code 124). The dots on one side of the bar belong to one half of the tile, and the dots on the other side belong to the other half.
Each half of each tile contains between 0 and 6 dots, inclusive.
Output
Print Yes if the two tiles can be matched, and No otherwise.