Determine if Two Strings Are Close LeetCode solution in Python
1# Runtime: 137 ms (Top 70.4%) | Memory: 17.77 MB (Top 49.0%)23from collections import Counter456class Solution:7def closeStrings(self, word1: str, word2: str) -> bool:8return set(word1) == set(word2) and Counter(Counter(word1).values()) == Counter(9Counter(word2).values()10)