Each letter in the first string (except spaces) should have exactly one counterpart in the second string (keeping in mind that a letter can be repeated in a word).
So, you could loop through each letter in the first string, then loop through each letter in the second string until you get a match, making sure you don't count the same letter twice from the second string.
To satisfy case insensitivity, you can just make both strings all lowercase.