public static List<List<Character>> comb(int k, List<Character> list) {
        List<List<Character>> result = new ArrayList<List<Character>>();
        Set<Character> visited = new HashSet<Character>();

        if (k > list.size() || k <= 0)
            return result;
        if (k == 1) {
            for (Character c : list) {
                if (!visited.contains(c)) {
                    List<Character> charList = new ArrayList<Character>();
                    charList.add(c);
                    result.add(charList);
                    visited.add(c);
                }
            }
            return result;
        }

        for (int i = 0; i <= list.size() - k; i ++) {
            if (!visited.contains(list.get(i))) {
                List<List<Character>> prevResult = comb(k - 1, list.subList(i + 1, list.size()));
                for (List<Character> subResult : prevResult) {
                    subResult.add(0, list.get(i));
                    result.add(subResult);
                }
                visited.add(list.get(i));
            }
        }

        return result;
    }