14908 - Prowling Folder Path   

Description

Prowler is the newest file management system in the market, using the following operations to prowl through folders in computers.

  • "..": Go to the parent directory of the current directory, no need to move if in '/home' directory
  • "./" : Stay in the current directory
  • "<folder_name>/": Move to <folder_name>, if <folder_name> doesn't exist in the current directory, create a new folder called <folder_name> in the current directory.
  • "pwd": Output the path from 'home' directory to current directory.

Your first job in Prowler is to recreate this system using C++ and one of the data structures you learned last week.

Note: You always start at /home directory

 

 

Input

Input consist of N lines of commands that only include the commands listed above.

<folder_name> will always be a string that only contains upper/lower case letters, underscore('_') and numbers

The last command will always be 'pwd'.

The input ends by reaching end of file(EOF)

N<=100000

Hint: Use while(read command line here) to read the inputs until EOF.

Output

Output the path from '/home' folder to current directory only when processing 'pwd' command.

You don't need to output anything for other commands.

Every output line needs to end with '\n'.

Sample Input  Download

Sample Output  Download

Tags

stack



Discuss