#include <iostream>
#include <string>
#include <sstream>
#include <set>
using namespace std;
string str;
set<string> st;
int main()
{
while (getline(cin, str) && str[0] != '#')
{
st.clear();
istringstream is(str);
string sub;
while (is >> sub)
{
st.insert(sub);
}
cout << st.size() << endl;
}
return 0;
}