#include <stdio.h>
#include <string.h>
#include <set>
#include <map>
#include <string>
#include <iostream>
using namespace std;
map<string,int> m;
int main()
{
string str, tmp;
int i;
while(getline(cin,str)) {
if(str =="#") break;
m.clear();
i = 0;
int len = str.size();
while(i<len){
tmp = "";
while(i<len&&'a'<=str[i]&&str[i]<='z') tmp +=str[i++];
if(tmp !="")
{
m[tmp] = 1;
}
i++;
}
cout<<m.size()<<endl;
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2luY2x1ZGUgPHNldD4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKbWFwPHN0cmluZyxpbnQ+IG07CgppbnQgbWFpbigpCnsKICAgIHN0cmluZyBzdHIsIHRtcDsKICAgIGludCBpOwogICAgd2hpbGUoZ2V0bGluZShjaW4sc3RyKSkgewogICAgICAgIGlmKHN0ciA9PSIjIikgYnJlYWs7CiAgICAgICAgbS5jbGVhcigpOwogICAgICAgIGkgPSAwOwogICAgICAgIGludCBsZW4gPSBzdHIuc2l6ZSgpOwogICAgICAgIHdoaWxlKGk8bGVuKXsKICAgICAgICAgICAgdG1wID0gIiI7CiAgICAgICAgICAgIHdoaWxlKGk8bGVuJiYnYSc8PXN0cltpXSYmc3RyW2ldPD0neicpIHRtcCArPXN0cltpKytdOwogICAgICAgICAgICBpZih0bXAgIT0iIikKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgbVt0bXBdID0gMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpKys7CiAgICAgICAgfQogICAgICAgIGNvdXQ8PG0uc2l6ZSgpPDxlbmRsOwogICAgfQogICAgcmV0dXJuIDA7Cn0K