Two strings are considered close if one can be transformed into the other by applying any sequence of the following operations:
Operation abcde becomes aebcd.
Operation aacabb becomes bbcbaa by transforming all a characters to b and all b characters to a.
You may apply these operations on either string as many times as needed.
Given two strings, word1 and word2, return true if word1 and word2 are close, and false otherwise.
Constraints:
word1.length, word2.length
word1 and word2 contain only lowercase English letters.
Two strings are considered close if one can be transformed into the other by applying any sequence of the following operations:
Operation abcde becomes aebcd.
Operation aacabb becomes bbcbaa by transforming all a characters to b and all b characters to a.
You may apply these operations on either string as many times as needed.
Given two strings, word1 and word2, return true if word1 and word2 are close, and false otherwise.
Constraints:
word1.length, word2.length
word1 and word2 contain only lowercase English letters.