#include//此种解法dsds# dsds是可以输入的,但是HDOJ也通过了。下面的解法解决了此问题。
#include
#include
using namespace std;
int main()
{
char c='0';
string s;
set word;
while((c=getchar())!='#')//注意getchar()和cin 的区别
{
s="";
while(c!=' '&&c!='\n')
{
s+=c;
c=getchar();
}
if(s.length()) word.insert(s);
if(c=='\n')
{
cout<
word.clear();
}
}
return 0;
}
#include
#include
#include
using namespace std;
int main()
{
char c='0';
string s;
set word;
while((c=getchar())!='#')
{
s="";
while(c!=' '&&c!='\n'&&c!='#')
{
s+=c;
c=getchar();
}
if(c=='#') return 0;
if(s.length()) word.insert(s);
if(c=='\n')
{
cout<
word.clear();
}
}
return 0;
}