#K7406. Normalize File Path
Normalize File Path
Normalize File Path
You are given a file path as a string in POSIX style. Your task is to normalize the given file path by:
- Removing the current directory indicators
.
- Handling parent directory indicators
..
appropriately, by moving up one directory level when possible - Reducing multiple consecutive slashes (
/
) to a single slash
Note that if the input path is absolute (i.e. it starts with a slash), the normalized path should also be absolute. If the input path is empty, return "/".
For example, given the path "/a/./b/../../c/" the normalized path is "/c".
inputFormat
The input consists of a single line containing a file path string.
You should read the input from standard input (stdin).
outputFormat
Output a single line containing the normalized file path, printed to standard output (stdout).
## sample/home/
/home