#include <iostream>
#include <string>
#include <map>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main()
{
char c;
map<string,int> word;
while((c=getchar() )!='#')
{
string temp="";
while(c!=' '&&c!=' '&&c!='#')
{
temp+=c;
c=getchar();
}
//int m=word.size();
if(c=='#') return 0;
if(temp.length() ) word.insert(map<string,int> :: value_type(temp,0)) ;
if(c==' ')
{cout<<word.size()<<endl; word.clear();}
}
return 0;
}