void print(char str[][]){
        Map<Character,Boolean> visited = new HashMap<Character,Boolean>();
        Map<Character,Boolean> alreadyPrinted = new HashMap<Character,Boolean>();
        for(int i=0 ; i < str.length; i++){
            if(!visited.containsKey(str[i][0]) || !visited.get(str[i][0])){
                
                if(!alreadyPrinted.containsKey(str[i][0]) || !alreadyPrinted.get(str[i][0])){
                    System.out.println(str[i][0]);
                    alreadyPrinted.put(str[i][0],true);
                }
                DFS(str,i,5,visited);
            }
        }
    }
http://www.geeksforgeeks.org/custom-tree-problem/
src/com/interview/recursion/PrintArrayInCustomizedFormat.java