Given an absolute path for a Unix-style file system, which begins with a slash `'/'`, transform this path into its simplified **canonical path**.
In Unix-style file system:
- A single period `'.'` refers to the current directory.
- A double period `'..'` refers to the directory up a level.
- Multiple consecutive slashes such as `'//'` and `'///'` are treated as a single slash `'/'`.
- Any other format of periods such as `'...' ` are treated as file/directory names.
The canonical path should have the following format:
- The path starts with a single slash `'/'`.
- Any two directories are separated by a single slash `'/'`.
- The path does not end with a trailing `'/'`.
- The path only contains the directories on the path from the root directory to the target file or directory.
### Constraints
- `1 <= path.length <= 3000`
- `path` consists of English letters, digits, period `'.'`, slash `'/'` or `'_'`.
- `path` is a valid absolute Unix path.
### Input Format
A single line containing the path string.
### Output Format
Print the simplified canonical path.
Sample Cases
Example 1Sample Case
Input: /home/
Output: /home
Example 2Sample Case
Input: /../
Output: /
Example 3Sample Case
Input: /
Output: /
Example 4Sample Case
Input: /h
Output: /h
Constraints
Runtime Limit: 2000 ms per test batch
Memory Limit: 256 MB
Standard I/O stream reading
Official submissions are evaluated against hidden test cases on the server to verify time & memory complexity.