Cherry isn't feeling well right now as she found a problem that she couldn't solve. So she started to listen to Giveaway and you, to make her happy, have to solve the problem for her.
You are given two strings $a$
and $b$
. You have to find if there is a non-empty substring of $a$
which is also a substring of $b$
.
A substring of a string is a contiguous subsequence of that string. So, string "cute" is substring of string "acute", but string "ace" is not.
The first line of the input contains the string $a$
consisting only of lowercase Latin letters.
The next line contains the string $b$
consisting only of lowercase Latin letters.
The length of each string is positive and doesn't exceed $10^5$
.
If there is a non-empty substring of $a$
which is also a substring of $b$
, then output "YES"(without quotes) or output "NO"(without quotes) otherwise.
Input | Output |
---|---|
you yourcrush | YES |
For example, the string "yo" is a substring of both "you" and "yourcrush". |
Input | Output |
---|---|
me yourcrush | NO |
Input | Output |
---|---|
bojack diane | YES |