Contact: aviboots(AT)netvision.net.il
39,845 questions
51,766 answers
573 users
func commonCharactersCount(_ str1: String, _ str2: String) -> Int { let set1 = Set(str1) let set2 = Set(str2) return set1.intersection(set2).count } let str1 = "abcdefg" let str2 = "xayzgoe" print(commonCharactersCount(str1, str2)) /* run: 3 */