首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

HDU 2072 之统计不同的单纯词个数

2012-08-27 
HDU 2072 之统计不同的单词个数#includeiostream#includeset#includestringusing namespace std in

HDU 2072 之统计不同的单词个数

#include<iostream>#include<set>#include<string>using namespace std ;int main(){  string s ;  set<string> st ;  char c ;    while((c=cin.get())!='#')  {     if(c!=' ')     {      s+=c;     }     while(c!='\n')     {        while((c=cin.get())!=' '&&c!='\n')        {           s+=c;        }         if(s.length())         st.insert(s);         s="";     }            cout<<st.size()<<endl;       st.clear();  }      return 0 ;}

热点排行