Skip to content

Instantly share code, notes, and snippets.

@imedadel
Created October 28, 2019 14:34
Show Gist options
  • Select an option

  • Save imedadel/a6d0a42c94105d03e722756eb4a97db1 to your computer and use it in GitHub Desktop.

Select an option

Save imedadel/a6d0a42c94105d03e722756eb4a97db1 to your computer and use it in GitHub Desktop.
pairs = int(input())
from collections import Counter
def checkPairs(first, second):
firstCount = Counter(first)
secondCount = Counter(second)
commonLettersExist = firstCount - secondCount != firstCount
if commonLettersExist:
return "YES"
else:
return "NO"
while(pairs > 0):
pairs -= 1
firstWordLetters = [letter for letter in input().strip()]
secondWordLetters = [letter for letter in input().strip()]
print(checkPairs(firstWordLetters, secondWordLetters))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment