作者:沝伊 | 来源:互联网 | 2024-09-28 15:17
#include "stdafx.h"
#include "iostream"
#include "sstream"
#include "map"
#include "string"
#include "list"
#include "vector"
#include
using namespace std;
int main()
{
string inputstr;
string str;
getline(cin,inputstr);
string::size_type index=0;
for (index = 0;index != inputstr.size();index++)
{
if(ispunct(inputstr[index]))
{
inputstr[index] = ‘ ‘;
}
}
istringstream stream(inputstr);
vector svec;
vector::iterator isvec;
bool find = false;
while (stream>>str)
{
find = false;
for (isvec = svec.begin(); isvec != svec.end();isvec++)
{
if (*isvec == str)
{
find = true;
}
}
if (find == false)
{
svec.push_back(str);
}
}
for (isvec = svec.begin(); isvec != svec.end();isvec++)
cout<<*isvec<<" ";
cout<}
去掉英文句子中重复出现的单词和标点符号,布布扣,bubuko.com