// The "Dw3" class.
import java.io.*;
import java.util.*;
public class Dw3
{
    public static void main (String[] args) throws IOException
    {
	BufferedReader br = new BufferedReader (new FileReader ("DATA3.txt"));
	PrintWriter pw = new PrintWriter (new FileWriter ("OUT3.txt"));
	int k = 0;
	for (int i = 0 ; i < 5 ; i++)
	{
	    String str[] = new String [510];
	    Arrays.fill (str, "");
	    String temp2 = br.readLine ();
	    String temp = br.readLine ();
	    String con1 = temp2 + temp;
	    int len = con1.length ();
	    int count = 1;
	    for (int j = 0 ; j < len ; j++)
	    {
		if (con1.charAt (j) != '/')
		    str [count] += con1.charAt (j) + "";
		else
		{
		    str [count] += con1.charAt (j) + "";
		    count++;
		}
	    }
	    int count1 = 0;
	    for (int j = 1 ; j < 510 ; j++)
	    {
		if (str [j].equals ("./"))
		    str [j] = "";
		if (str [j].equals ("../"))
		{
		    if (str [j + 1].equals ("../"))
		    {
			while (str [j].equals ("../"))
			{
			    j++;
			    count1++;
			}
			int check = j - count1 * 2;
			if (check < 1)
			    k = 1;
			for (k = k ; k < j ; k++)
			    str [k] = "";
			j--;
			count1 = 0;
		    }
		    else
		    {
			str [j] = "";
			str [j - 1] = "";
		    }

		}
	    }
	    String con = "";
	    for (int j = 0 ; j < 255 ; j++)
		con += str [j] + "";
	    if (con.charAt (0) != '/')
		con = "/" + con;
	    pw.println (con);
	}
	pw.close ();

	// Place your code here
    } // main method
} // Dw3 class



