Shadow Sentences

Published by Werdna in

Given two sentences, return whether they are shadows of each other. This means that all of the word lengths are the same, but the corresponding words don't share any common letters.

Examples

shadowSentence("they are round", "fold two times") ➞ true

shadowSentence("own a boat", "buy my wine") ➞ false
// No words share common letters, but "a" and "my" have different lengths.

shadowSentence("his friends", "our company") ➞ false
// Word lengths are the same but "friends" and "company" share the letter "n".

shadowSentence("salmonella supper", "birthright") ➞ false
// Setences with different numbers of words.

Notes

  • All sentences will be given in lowercase, and will have no punctuation.
  • Return false if the sentences have different numbers of words.
Watch a quick demo on how Edabit works.