~/algor $ cat problems/stack-fayl-yoli
Simplifying a file path
Medium
1000 ms
128 MB
58%
In a file system a path consists of names separated by the character / and starts with / (the root folder). . is the current folder, .. is the folder one level up (at the root .. changes nothing), and several / in a row count as one /. Bring the given path to its simplest form: it starts with /, there is exactly one / between names, . and .. do not occur, and there is no / at the end (if it is the root itself, / is printed).
Input
One line with the path.
Output
The simplified path.
Note
the length of the path is from $1$ to $10^{4}$
names consist of $1$ to $8$ lowercase Latin letters and digits
Examples
Input #1
/home//user/./docs/../music/
Output #1
/home/user/music
Input #2
/../
Output #2
/