Simplify directory pathMedium
Let's say you're given a dirty directory path:
The simplified version of the above path is the following:
Write a function that accepts a dirty directory path and returns the simplified version.
The directory path can be cleaned using the following rules:
- Mutiple slashes like
///is the same as a single slash
- The two dots in
/../implies looking at the parent directory
- A single dot like
/./implies to stay in the current path.