524. Final Interview Round

0

Medium

During the final interview round of a company, Vamica was given a string path as a question. The path represents an absolute path in a Unix-style file system. Vamica's task is to convert the path into its simplified canonical form. In a Unix-style file system, a period '.' represents the current directory, a double period '..' represents the directory up a level, and multiple consecutive slashes (i.e. '//') are treated as a single slash '/'. However, any other format of periods such as '...' should be treated as file or directory names. The canonical path should adhere to the following format: 1. The path must start with a single slash '/'. 2. Any two directories should be separated by a single slash '/'. 3. The path should not end with a trailing '/'. 4. The path should only contain the directories on the path from the root directory to the target file or directory (i.e., no period '.' or double period '..').

Input Format

The first line of the input contains the absolute path in the form of a string.

Output Format

Print the canonical path.

Example

Input

/home/

Output

/home

Constraints

1 <= path.length <= 3000
path consists of English letters, digits, period '.', slash '/' or '_'.
path is a valid absolute Unix path.
Loading...

View Submissions

Console