Suppose we have a file system that stores both files and directories. Given a string input representing the file system in a specific format, return the length of the longest absolute path to a file in the abstracted file system.
The input string uses \n (newline) to separate different files/directories, and \t (tab) characters to represent the depth level in the directory hierarchy.
Each file name is of the form name.extension, while directory names consist of letters, digits, and/or spaces without extensions.
For example:
"dir\n\tsubdir1\n\t\tfile1.ext\n\t\tsubsubdir1\n\tsubdir2\n\t\tsubsubdir2\n\t\t\tfile2.ext"represents the directory structure where file2.ext has the absolute path "dir/subdir2/subsubdir2/file2.ext" with length 32.
If there is no file in the system, return 0.
Input & Output
Constraints
- 1 ≤ input.length ≤ 104
- input contains only valid directory/file names
- File names contain exactly one '.' character
- No empty directory or file names