#1657 - Determine if Two Strings Are Close
Two strings are considered close if you can attain one from the other using these operations any number of times: (1) swap any two existing characters, (2) transform every occurrence of one existing character into another existing character, and simultaneously do the reverse. Return true if word1 and word2 are close, or false otherwise.
| Input | Output |
|---|---|
word1 = "abc", word2 = "bca" | true |
word1 = "a", word2 = "aa" | false |
word1 = "cabbba", word2 = "abbccc" | true |