#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
struct node
{
    map<string, node> subdir;
    set<string> file;
    string name;
};
void insert_node(node &n, string s)
{
    auto pos = s.find('/');
    if (pos == string::npos)
        n.file.insert(s);
    else
        insert_node(n.subdir[s.substr(0, pos)], s.substr(pos + 1));
}
void indent(int x)
{
    while (x--) cout << "    ";
}
void display(node &n, int depth)
{
    for (auto &x : n.subdir)
    {
        indent(depth);
        cout << x.first << endl;
        display(x.second, depth + 1);
    }
    for (auto &x : n.file)
        indent(depth), cout << x << endl;
}
int main()
{
    ios::sync_with_stdio(false);
    int t = 0;
    string s;
    node *root = nullptr;
    while (getline(cin, s))
        if (s == "0")
        {
            cout << "Case " << ++t << ":" << endl;
            if (root)
            {
                display(*root, 0);
                delete root;
            }
            root = nullptr;
        }
        else
        {
            if (root == nullptr) root = new node();
            insert_node(*root, s);
        }
    return 0;
}
