HDOJ 2072(map)

#include<cstdio>
#include<iostream>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<deque>
#include<cmath>
#include<set>
#include<cstring>
#include<string>
using namespace std;
string s,str;
map<string,int>m;
int main()
{
    while(getline(cin,s)&&s!="#"){
        int sign=0;
        m.clear();
        int len=s.length();
        for(int i=0;i<len;i++){
            str.clear();
            while(s[i]>='a'&&s[i]<='z'){
                str+=s[i++];
                sign=1;
            }
            if(sign){
                m[str]++;
                sign=0;
            }
        }
        int ans=m.size();
        cout<<ans<<endl;
    }
}

猜你喜欢

转载自www.cnblogs.com/frente/p/10556115.html