Two strings have a letter in common if it appears in both strings. The position of letter is not important for it to be counted as common. Once a particular letter is counted as in common, it cannot be counted again. For example, an o appearing twice in one word but only once in the other counts only as one letter in common. However, an o appearing twice both words counts as two letters in common.
Write a function that takes two strings and returns the number of letters they have in common.
Hint: you will need some way to avoid counting a letter more than once if it is in common to both words. To do this, replace each letter with a nonsense character once you have examined it using the String method replace, replaceAll, or replaceFirst.
"horse" "mirth"Returns: 2
"horse" "short"Returns: 4
"horse" "moose"Returns: 3
"horse" "seems"Returns: 2