AlgoUniversity
  • Go Back
Discussion
Similar Order :

Author

Akshay Sharma

Difficulty Level : Medium

Submissions : 207

Asked In : PayPal

Marks :100

: 1 | : 0

Given the list of string representing each order from 2 customers and each character in the order representing an item, find if the orders were similar.

Condition for being similar Should be the same length and the number of distinct characters should not be more than 3

Input

The first line of each test case contains a string of words separated by space name customer1 ($$$1 \le customer1 \le 100$$$).($$$1 \le customer1_i \le 1000$$$). The next line contains string of words separated by space name customer2 ($$$1 \le customer2 \le 100$$$).($$$1 \le customer2_i \le 1000$$$).

Output

For each test case print capital YES if ($$$ customer1_i $$$) order for customer 1 is similar to customer 2($$$ customer2_i $$$) else print capital NO.

Example

Input
nnbnnb ammxdf
bbncbb aecdx
Output
YES NO

Note

X: ["nnbnnb","ammxdf"]

y: ["bbncbb","aecxdf"]

Output : ["YES","NO"]

x[0] is similar to y[0] as both same in length and

x[0] has 4"n", y[0] has 1 n,so delta is 1.

x[0] has 2 "b", y[0] has 4 "b" so delta is 2.

x[0] has 0 "c", y[0] has 1 "c" so delta is 1.

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.