Given two strings, determine if they share a common substring. A substring may be as small as one character.
For example, the words “a”, “and”, “art” share the common substring a . The words “be” and “cat” do not share a substring.
def twoStrings(s1, s2): flag=False for c in s1: if c in s2: flag=True break if flag: return ('YES') else: return ('NO')