# Account code tree Create a method that given the input generates the output. # Input ``` /a/b /a/d /a/d/c /a/b/c /x/y ``` # Output A data structure representing the logical tree ```typescript //code here interface Node { name: string; children: Node[]; } [name]: children; fileSystem = { pathName: "a", directories: [{ pathName: "b", directories: [{ pathName: "c", directories: [] }] }, { pathName: "d", directories: [{ pathName: "c", directories: [] }] }] } { "a": [ "b": [], "c": [] ] } const blockOfInput = "..."; const processedData = {}; const mapLineOfInput = (line: string) => { const kewords = line.split("/"); let currentData = processedData; for (let i = 1; i < keywords.length; i++) { const pathName = keywords[i]; if (!currentData[pathName]) { currentData.set(pathName, {}); currentData[pathName] = {}; } currentData = currentData[pathName]; } }; blockOfInput.split("\n").forEach(mapLineOfInput); ```