AlgoUniversity
  • Go Back
Discussion
Naming Twins :

Author

Akshay Sharma

Difficulty Level : Easy

Submissions : 299

Asked In : PhonePe

Marks :100

: 1 | : 0

One pair of twins are born in a village . The parents wanted to name the children and for this, they went to the village leader. The leader suggested they keep the names of the children such that the difference between the frequency of each letter from 'a' to 'z' between two names is at most 3. You will be given two names. If the two names satisfy the condition print a single string "YES". If the condition is not met, print "NO".

Input

The first line of the test case contains two space-separated strings s1 and s2 denoting the names of the first child name and second child name. Constraints:

($$$ 1 \le length of each name \le 1000 $$$)

Output

print "YES" if it is possible to name the twins else "NO"

Examples

Input
abcdeef abaaacc
Output
YES
Input
NO
Output
NO

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.