Skip to content

Instantly share code, notes, and snippets.

@mhlangagc mhlangagc/strings.swift
Last active Apr 22, 2016

Embed
What would you like to do?
func twoStrings(stringA: String, stringB: String) -> String {
let firstSet = Set(stringA.lowercaseString.characters)
let secondSet = Set(stringB.lowercaseString.characters)
if firstSet.intersect(secondSet).count > 0 {
return "YES"
} else {
return "NO"
}
}
let test = Int(readLine()!)
for var i = 0; i < test; i+=1 {
let string1 = String(readLine()!)
let string2 = String(readLine()!)
print(twoStrings(string1, stringB: string2))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.