import java.util.*;

public class TreeExample {

    // Class representing each node in the tree
    static class TreeNode {
        String name;
        List<TreeNode> children;

        TreeNode(String name) {
            this.name = name;
            this.children = new ArrayList<>();
        }

        // Adds a child to the current node
        void addChild(TreeNode child) {
            children.add(child);
        }
    }

    // Class to build and manage the tree
    static class TreeBuilder {
        private TreeNode root;
        private Map<String, TreeNode> nodeMap;

        public TreeBuilder() {
            this.nodeMap = new HashMap<>();
        }

        /**
         * Initializes the tree with a root node and its immediate children.
         *
         * @param nodeName The name of the root node.
         * @param children An array of child names. If a child name contains ":", it's treated as a node that can have further items.
         */
        public void tree(String nodeName, String[] children) {
            root = new TreeNode(nodeName);
            nodeMap.put(nodeName, root);

            for (String child : children) {
                String[] parts = child.split(":", 2);
                String childName = parts[0].trim();
                TreeNode childNode = new TreeNode(childName);
                root.addChild(childNode);
                nodeMap.put(childName, childNode);
            }
        }

        /**
         * Injects items into a specified node.
         *
         * @param nodeName The name of the node to inject items into.
         * @param items    An array of item names to add as children to the node.
         */
        public void nodeInjector(String nodeName, String[] items) {
            TreeNode parentNode = nodeMap.get(nodeName);
            if (parentNode == null) {
                System.out.println("Node \"" + nodeName + "\" does not exist.");
                return;
            }

            for (String item : items) {
                String[] parts = item.split(":", 2);
                String itemName = parts[0].trim();
                TreeNode itemNode = new TreeNode(itemName);
                parentNode.addChild(itemNode);
                nodeMap.put(itemName, itemNode);
            }
        }

        /**
         * Displays the tree structure in a format similar to Windows' tree command.
         */
        public void displayTree(String rootPath) {
            System.out.println("Folder PATH listing");
            System.out.println("Volume serial number is 2063-E788"); // Example serial number
            System.out.println(rootPath);
            displayTreeHelper(root, "", true);
        }

        // Helper method for displaying the tree
        private void displayTreeHelper(TreeNode node, String prefix, boolean isLast) {
            if (node == null) return;

            System.out.print(prefix);
            if (prefix.isEmpty()) {
                // Root node
                System.out.println(node.name);
            } else {
                // Decide which branch to use
                if (isLast) {
                    System.out.print("\u2514\u2500\u2500\u2500"); // "└───"
                } else {
                    System.out.print("\u251C\u2500\u2500\u2500"); // "├───"
                }
                System.out.println(node.name);
            }

            // Prepare prefix for children
            String childPrefix;
            if (prefix.isEmpty()) {
                childPrefix = "";
            } else {
                if (isLast) {
                    childPrefix = prefix + "    "; // Add spaces if last
                } else {
                    childPrefix = prefix + "\u2502   "; // "│   " for vertical lines
                }
            }

            // Iterate through children
            for (int i = 0; i < node.children.size(); i++) {
                TreeNode child = node.children.get(i);
                boolean childIsLast = (i == node.children.size() - 1);
                displayTreeHelper(child, childPrefix, childIsLast);
            }
        }
    }

    // Main method to demonstrate the usage
    public static void main(String[] args) {
        TreeBuilder treeBuilder = new TreeBuilder();

        // Define a sample tree structure
        treeBuilder.tree("C:\\USERS\\YOUSS\\APPDATA\\LOCAL\\TEMP", new String[]{
            "0b75655200331fb34762b7b83035d6a8"
        });

        // Inject items into "0b75655200331fb34762b7b83035d6a8"
        treeBuilder.nodeInjector("0b75655200331fb34762b7b83035d6a8", new String[]{
            "android:items",
            "gradle:items" // Assuming we want "gradle" to act as a node that can have its own items
        });

        // Inject items into "android"
        treeBuilder.nodeInjector("android", new String[]{
            "app:items",
            "gradle:items"
        });

        // Inject items into "app"
        treeBuilder.nodeInjector("app", new String[]{
            "src:items"
        });

        // Inject items into "src"
        treeBuilder.nodeInjector("src", new String[]{
            "debug",
            "main:items"
        });

        // Inject items into "main"
        treeBuilder.nodeInjector("main", new String[]{
            "java:items",
            "res:items"
        });

        // Inject items into "java"
        treeBuilder.nodeInjector("java", new String[]{
            "com:items"
        });

        // Inject items into "com"
        treeBuilder.nodeInjector("com", new String[]{
            "startsphere"
        });

        // Inject items into "res"
        treeBuilder.nodeInjector("res", new String[]{
            "drawable",
            "mipmap-hdpi",
            "mipmap-mdpi",
            "mipmap-xhdpi",
            "mipmap-xxhdpi",
            "mipmap-xxxhdpi",
            "values"
        });

        // Inject items into "gradle" under "android"
        treeBuilder.nodeInjector("gradle", new String[]{
            "wrapper"
        });

        // Display the tree structure
        String rootPath = "C:\\USERS\\YOUSS\\APPDATA\\LOCAL\\TEMP";
        treeBuilder.displayTree(rootPath);

        /*
         * Sample Output:
         * Folder PATH listing
         * Volume serial number is 2063-E788
         * C:\USERS\YOUSS\APPDATA\LOCAL\TEMP
         * C:\USERS\YOUSS\APPDATA\LOCAL\TEMP
         * ├───0b75655200331fb34762b7b83035d6a8
         * │   ├───android
         * │   │   ├───app
         * │   │   │   └───src
         * │   │   │       ├───debug
         * │   │   │       └───main
         * │   │   │           ├───java
         * │   │   │           │   └───com
         * │   │   │           │       └───startsphere
         * │   │   │           └───res
         * │   │   │               ├───drawable
         * │   │   │               ├───mipmap-hdpi
         * │   │   │               ├───mipmap-mdpi
         * │   │   │               ├───mipmap-xhdpi
         * │   │   │               ├───mipmap-xxhdpi
         * │   │   │               ├───mipmap-xxxhdpi
         * │   │   │               └───values
         * │   │   └───gradle
         * │   │       └───wrapper
         */
    }
}

---

ERROR!
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0xE2) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                      ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0x94) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                       ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0x94) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                        ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0xE2) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                         ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0x94) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                          ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0x80) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                           ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0xE2) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                            ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0x94) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                             ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0x80) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                              ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0xE2) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                               ^
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0x94) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                                ^
/tmp/AgeNghKlhF/TreeExample.java:92: error: unmappable character (0x80) for encoding US-ASCII
                    System.out.print("\u2514\u2500\u2500\u2500"); // "????????????"
                                                                                 ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:94: error: unmappable character (0xE2) for encoding US-ASCII
                    System.out.print("\u251C\u2500\u2500\u2500"); // "????????????"
                                                                      ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:94: error: unmappable character (0x94) for encoding US-ASCII
                    System.out.print("\u251C\u2500\u2500\u2500"); // "????????????"
                                                                       ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:94: error: unmappable character (0x9C) for encoding US-ASCII
                    System.out.print("\u251C\u2500\u2500\u2500"); // "????????????"
                                                                        ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:94: error: unmappable character (0xE2) for encoding US-ASCII
                    System.out.print("\u251C\u2500\u2500\u2500"); // "????????????"
                                                                         ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:94: error: unmappable character (0x94) for encoding US-ASCII
                    System.out.print("\u251C\u2500\u2500\u2500"); // "????????????"
                                                                          ^
ERROR!
/tmp/AgeNghKlhF/TreeExample.java:94: error: unmappable character (0x80) for encoding US-ASCII
                    System.out.print("\u251C\u2500\u2500\u2500"); // "????????????"
                                                                           ^

=== Code Exited With Errors ===

---

Fix the errors