Giveaway

YouKnowWho Replay of Virtual Techfes...
Limits 1s, 512 MB

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.

Input

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$.

Output

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.

Samples

InputOutput
you
yourcrush
YES

For example, the string "yo" is a substring of both "you" and "yourcrush".

InputOutput
me
yourcrush
NO
InputOutput
bojack
diane
YES

Submit

Login to submit.

Statistics

88% Solution Ratio
BigO_cutterEarliest, Dec '20
sh2018331053Fastest, 0.0s
nabilsnigdhoLightest, 131 kB
bokaifShortest, 46B
Toph uses cookies. By continuing you agree to our Cookie Policy.