Split a string can be quite useful sometimes, especially when you need only certain parts of strings. A simple yet effective example is splitting the First-name and Last-name of a person. Another application is CSV(Comma Separated Files). We use split to get data from CSV and join to write data to CSV.
Given a pair of non empty strings. Count the number of matching characters in those strings (consider the single count for the character which have duplicates in the strings). Examples:
Input : str1 = 'abcdef' str2 = 'defghia' Output : 4 (i.e. matching characters :- a, d, e, f) Input : str1 = '[email protected]' str2 = '[email protected]' Output : 5 (i.e. matching characters :- b, 1, 2, @, k)