Gennady and a Card Game

题意翻译

根纳迪在乡下有一家小旅馆,他在那里过着平静的生活。 他喜欢长时间散步,看日落,和住在他酒店的游客打牌。 他最喜欢的游戏是“茅茅”,要玩茅茅,你需要一副一共52张牌。每张牌都有一个花色(方块D,梅花c,黑桃s,或红h)和一个等级(2,3,4,5,6,7,8,9,T, J, Q, K,或a)。 当且仅当牌的等级或花色与桌上的牌相同时,你就可以用自己的手牌来玩牌(也就是打牌)。 为了检验你是否是个好搭档,Gennady为你准备了一项任务。现在给定桌上的牌和手中的五张牌,检查你是否至少能打一张牌。

题目描述

Gennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, watch sunsets and play cards with tourists staying in his hotel. His favorite game is called "Mau-Mau". To play Mau-Mau, you need a pack of $ 52 $ cards. Each card has a suit (Diamonds — D, Clubs — C, Spades — S, or Hearts — H), and a rank (2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, or A). At the start of the game, there is one card on the table and you have five cards in your hand. You can play a card from your hand if and only if it has the same rank or the same suit as the card on the table. In order to check if you'd be a good playing partner, Gennady has prepared a task for you. Given the card on the table and five cards in your hand, check if you can play at least one card.

输入输出格式

输入格式


The first line of the input contains one string which describes the card on the table. The second line contains five strings which describe the cards in your hand. Each string is two characters long. The first character denotes the rank and belongs to the set $ \{{\tt 2}, {\tt 3}, {\tt 4}, {\tt 5}, {\tt 6}, {\tt 7}, {\tt 8}, {\tt 9}, {\tt T}, {\tt J}, {\tt Q}, {\tt K}, {\tt A}\} $ . The second character denotes the suit and belongs to the set $ \{{\tt D}, {\tt C}, {\tt S}, {\tt H}\} $ . All the cards in the input are different.

输出格式


If it is possible to play a card from your hand, print one word "YES". Otherwise, print "NO". You can print each letter in any case (upper or lower).

输入输出样例

输入样例 #1

AS
2H 4C TH JH AD

输出样例 #1

YES

输入样例 #2

2H
3D 4C AC KD AS

输出样例 #2

NO

输入样例 #3

4D
AS AC AD AH 5H

输出样例 #3

YES

说明

In the first example, there is an Ace of Spades (AS) on the table. You can play an Ace of Diamonds (AD) because both of them are Aces. In the second example, you cannot play any card. In the third example, you can play an Ace of Diamonds (AD) because it has the same suit as a Four of Diamonds (4D), which lies on the table.