Skip to content

Instantly share code, notes, and snippets.

@mhlangagc
Last active April 22, 2016 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhlangagc/da160892dbf1def50189eb9ba59af787 to your computer and use it in GitHub Desktop.
Save mhlangagc/da160892dbf1def50189eb9ba59af787 to your computer and use it in GitHub Desktop.
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