package leetcode;

import java.util.List;

/**
 * https://leetcode.com/problems/find-and-replace-pattern/
 */
public class Problem890 {
    public List<String> findAndReplacePattern(String[] words, String pattern) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem890 prob = new Problem890();
    }
}

@@ -12,16 +12,44 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0A
 import j
@@ -249,84 +249,320 @@
     
-// TODO%0A        return null;%0A    %7D%0A%0A    public static void main
+List%3CString%3E result = new ArrayList%3C%3E();%0A        String p = convert(pattern);%0A        for (String word : words) %7B%0A            String w = convert(word);%0A            if (p.equals(w)) %7B%0A                result.add(word);%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A%0A    private static String convert
 (String
-%5B%5D arg
+ 
 s) %7B
@@ -574,40 +574,364 @@
     
-Problem890 prob = new Problem890
+StringBuilder sb = new StringBuilder();%0A        int i = 1;%0A        int%5B%5D chars = new int%5B26%5D;%0A        for (char c : s.toCharArray()) %7B%0A            if (chars%5Bc - 'a'%5D == 0) %7B%0A                sb.append(i);%0A                chars%5Bc - 'a'%5D = i++;%0A            %7D else %7B%0A                sb.append(chars%5Bc - 'a'%5D);%0A            %7D%0A        %7D%0A        return sb.toString
 ();%0A

Solve problem 890