#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <cctype>
using namespace std;
int read() {
char ch;
ch = getchar();
if (ch == '#') return -1;
string tmp = "";
set<string> ss; ss.clear();
while (1) {
if (ch == ' ') { if (tmp != "") { ss.insert(tmp); }tmp = "";}
else
if (ch == '\n') {
if (tmp != "") {
ss.insert(tmp);
}
break;
}
else
{
tmp+=ch;
}
ch = getchar();//cout << tmp << endl;
}
/*for (auto it = ss.begin(); it != ss.end(); it++) {
cout << *it << endl;
}*/
return ss.size();
}
int main() {
int cnt;
while (cnt = read() , cnt != -1) {
cout << cnt << endl;
}
}