The company chief called a meeting of his employee to suggest the name of their new product that's going to launch soon. He wants the name to be made from the names of his two beloved daughters MARY and CARY. Given two names of equal length, find the longest name the employees can suggest that can be constructed such that it has the common alphabets of both the given names.
For example, MARY and CARY have the same 3 alphabets ARY and ARY. They can be formed by eliminating M and C from both the names. The name suggested by the employees can ARY, RAY or YAR which is of maximum length 3.
The function should return the longest string, which has the common alphabets of the input strings.
Write a function
solve that have the following parameter(s):
1.) a = a string
2.) b = a string
There are strings given:
The function will return,
RED and BLACK have no characters in common hence the output is 0.
• The size of two strings n1 and n2 will be greater than 1 and less than 5000.
• All the characters are an upper case in the range ascii[A-Z].