import java.util.HashSet;

public class Strings {

    static Character findFirstNonRepeated(String s) {
        if(s == null || s.length() == 0) {
            return null;
        }
        if(s.length() == 1) {
            return Character.valueOf(s.charAt(0));
        }
        HashSet<Character> chars = new HashSet<Character>();
        for (int i = 0; i < s.length(); i++) {
            Character character = Character.valueOf(s.charAt(i));
            if(!chars.add(character)) {
                return character;
            }
        }
        return null;
    }


    static String removeChars(String s, String toRemove) {
        if(s == null || s.isEmpty() || toRemove == null || toRemove.isEmpty()) {
            return s;
        }
        StringBuilder sb = new StringBuilder();
        HashSet<Character> del = new HashSet<Character>();
        for (int i = 0; i < toRemove.length(); i++) {
            del.add(Character.valueOf(toRemove.charAt(i)));
        }
        for (int i = 0; i < s.length(); i++) {
            char charAt = s.charAt(i);
            if(!del.contains(Character.valueOf(charAt))) {
                sb.append(charAt);
            }
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        assert findFirstNonRepeated("aaaaaa") .equals( Character.valueOf('a') ): findFirstNonRepeated("aaaaaa");
        assert findFirstNonRepeated("abcdefg") == null : findFirstNonRepeated("abcdefg");
        assert findFirstNonRepeated("abcadefg") .equals( Character.valueOf('a') ) : findFirstNonRepeated("abcadefg");

        assert "".equals(removeChars("aaaaaaaa", "a")) : removeChars("aaaaaaaa", "a");
        assert "b".equals(removeChars("aaabaaaa", "a")) : removeChars("aaabaaaa", "a");
        assert "abc".equals(removeChars("abc", "")) : removeChars("abc", "");
        assert "abc".equals(removeChars("abc", "d")) : removeChars("abc", "d");
        assert "".equals(removeChars("", "d")) : removeChars("", "d");
    }
}

@@ -1212,16 +1212,734 @@
 %0A    %7D%0A%0A
+    static char %5B%5D removeChars(char%5B%5D s, char%5B%5D toRemove) %7B%0A        if(s == null %7C%7C s.length == 0 %7C%7C toRemove == null %7C%7C toRemove.length == 0) %7B%0A            return s;%0A        %7D%0A        HashSet%3CCharacter%3E del = new HashSet%3CCharacter%3E();%0A        for (int i = 0; i %3C toRemove.length; i++) %7B%0A            del.add(Character.valueOf(toRemove%5Bi%5D));%0A        %7D%0A        int curr = 0;%0A        for (int i = 0; i %3C s.length; i++) %7B%0A            char charAt = s%5Bi%5D;%0A            if(!del.contains(Character.valueOf(charAt))) %7B%0A                s%5Bcurr%5D = charAt;%0A                curr ++;%0A            %7D%0A        %7D%0A        char %5B%5D newChars = new char%5Bcurr%5D;%0A        System.arraycopy(s, 0, newChars, 0, curr);%0A        return newChars;%0A    %7D%0A%0A
     publ
@@ -2697,20 +2697,626 @@
 s(%22%22, %22d%22);%0A
+%0A%0A        assert %22%22.equals(new String(removeChars(%22aaaaaaaa%22.toCharArray(), %22a%22.toCharArray()))) : removeChars(%22aaaaaaaa%22, %22a%22);%0A        assert %22b%22.equals(new String(removeChars(%22aaabaaaa%22.toCharArray(), %22a%22.toCharArray()))) : removeChars(%22aaabaaaa%22, %22a%22);%0A        assert %22abc%22.equals(new String(removeChars(%22abc%22.toCharArray(), %22%22.toCharArray()))) : removeChars(%22abc%22, %22%22);%0A        assert %22abc%22.equals(new String(removeChars(%22abc%22.toCharArray(), %22d%22.toCharArray()))) : removeChars(%22abc%22, %22d%22);%0A        assert %22%22.equals(new String(removeChars(%22%22.toCharArray(), %22d%22.toCharArray()))) : removeChars(%22%22, %22d%22);%0A
     %7D%0A%7D%0A

"inplace" remove