Alien language
Practice
3.3 (55 votes)
Ad Hoc
Approved
Basic programming
Easy
Open
Problem
79% Success 22025 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Little Jhool considers Jaadu to be a very close friend of his. But, he ends up having some misunderstanding with him a lot of times, because Jaadu's English isn't perfect, and Little Jhool sucks at the language Jaadu speaks. So, he's in a fix - since he knows that Jaadu has got magical powers, he asks him to help so as to clear all the issues they end up having with their friendship.

Now, Jaadu can only focus at one task, so to fix these language issues he comes up with a magical way out, but someone needs to do the rest of it; this is where Little Jhool has asked for your help.

Little Jhool says a word, and then Jaadu says another word. If any sub-string of the word said by Jaadu is a sub-string of the word said by Little Jhool, the output should be "YES", else "NO". (Without the quotes.)

Input:
First line contains number of test case T. Each test case contains two strings *Text ( Said by Jhool ) * and Pattern (Said by Jaadu ).Both strings contains only lowercase alphabets ['a'-'z'].

Output:
For each test case print YES if any sub-string of Pattern is sub-string of Text else print NO.

Constraints:
1<=T<=5
1<=|Text|<=100000
1<=|Pattern|<=100000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
256 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyOpen
Points:20
17 votes
Tags:
Data StructuresEasyHash MapsHash TablesImplementation
Points:20
52 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyHash MapsOpen