path is an absolute Unix-style path. Return its canonical form:
/,/,/ (except for the root / itself),. (this directory) is removed, and .. (parent directory) removes the previous name (at the root it does nothing).For "/a/./b/../../c/" the answer is "/c".
Example 1
Input:
simplify_path('/home/')
Output:
'/home'
Example 2
Input:
simplify_path('/a/./b/../../c/')
Output:
'/c'
1 <= len(path) <= 100000., _ and /; path starts with /...., is an ordinary name.No results yet
Run your code to check it against the examples, or submit to run every test.