package leetcode;

/**
 * https://leetcode.com/problems/determine-if-two-strings-are-close/
 */
public class Problem1657 {
    public boolean closeStrings(String word1, String word2) {
        if (word1.length() != word2.length()) {
            return false;
        }
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem1657 prob = new Problem1657();
        System.out.println(prob.closeStrings("abc", "bca")); // true
        System.out.println(prob.closeStrings("a", "aa")); // false
        System.out.println(prob.closeStrings("cabbba", "abbccc")); // true
        System.out.println(prob.closeStrings("cabbba", "aabbss")); // false
        System.out.println(prob.closeStrings("ababc", "aaabc")); // false
        System.out.println(prob.closeStrings("cbbaa", "ccbba")); // true
        System.out.println(prob.closeStrings("caabbb", "aabbccc")); // true
    }
}

@@ -12,16 +12,146 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A
 /**%0A * h
@@ -404,36 +404,661 @@
     
-// TODO%0A        return false
+Map%3CCharacter, Integer%3E map1 = new HashMap%3C%3E();%0A        Map%3CCharacter, Integer%3E map2 = new HashMap%3C%3E();%0A        for (int i = 0; i %3C word1.length(); i++) %7B%0A            map1.put(word1.charAt(i), map1.getOrDefault(word1.charAt(i), 0) + 1);%0A            map2.put(word2.charAt(i), map2.getOrDefault(word2.charAt(i), 0) + 1);%0A        %7D%0A        if (!map1.keySet().equals(map2.keySet())) %7B%0A            return false;%0A        %7D%0A        List%3CInteger%3E counts1 = new ArrayList%3C%3E(map1.values());%0A        List%3CInteger%3E counts2 = new ArrayList%3C%3E(map2.values());%0A        Collections.sort(counts1);%0A        Collections.sort(counts2);%0A        return counts1.equals(counts2)
 ;%0A  
@@ -1643,17 +1643,16 @@
 abbb%22, %22
-a
 abbccc%22)
@@ -1658,20 +1658,90 @@
 )); // true%0A
+        System.out.println(prob.closeStrings(%22uau%22, %22ssx%22)); // false%0A
     %7D%0A%7D%0A

Update problem 1657