Given an absolute path for a file (Unix-style), simplify it. In other words, convert it to the canonical path. In Unix-style file system, '.' refers to the current directory, '..' refers to the parent directory, and multiple slashes are treated as a single slash. The canonical path should have the format: a single leading slash, any two directories are separated by a single slash, and no trailing slash.
path = absolute file path string
canonical simplified path string
Example 1:
Input:
path = "/home/"
Output:
/home
Explanation:
Remove trailing slash.
Example 2:
Input:
path = "/a/./b/../../c/"
Output:
/c
Explanation:
"." stays same, ".." moves up one directory.