#include<bits/stdc++.h>
#define Son t[now].son[j]
using namespace std;
const int N=100005;
int n,i,j,l,top,now,cnt;
bool is_new,f;
string file,files[N];
struct p
{
string s;
vector<int> son;
}t[N];
int new_p(int fa,string name)
{
t[++cnt].s=name;
t[fa].son.push_back(cnt);
return cnt;
}
int main()
{
cin>>n;
while(n--)
{
cin>>file;
l=file.length();
file=file+'/';
for(top=0,i=1;i<l;i++)
{
files[++top].clear();
while(file[i]!='/') files[top]=files[top]+file[i++];
}
for(now=0,is_new=0,i=1;i<=top;i++)
{
if(!is_new)
{
for(j=0,f=0;j<t[now].son.size();j++)
{
if(files[i]==t[Son].s)
{
f=1;
now=Son;
}
}
if(!f)
{
is_new=1;
now=new_p(now,files[i]);
}
}
else now=new_p(now,files[i]);
}
cout<<cnt<<'\n';
}
return 0;
}