#include "stdafx.h"
#include<set>
#include<string>
#include<iostream>
using namespace std;
int main()
{
set<string> s;
char buf[1000]={0};
gets(buf);
char* p=buf;
while(*p!=0)
{
if(*p==',' || *p=='.')
{
*p=' ';
}
p++;
}
p=strtok(buf," ");
while(p!=NULL)
{
string tmp=p;
if(s.find(tmp)==s.end())
{
cout<<tmp<<" ";
s.insert(tmp);
}
p=strtok(NULL," ");
}
cout<<endl;
return 0;
}
2015年校招--华为上机笔试题--去重复单词
最新推荐文章于 2019-04-02 16:38:00 发布