Помогите написать программу с++, я не понимаю как искать одинаковые слова в строке
Приложения:

Ответы на вопрос
Ответил eugene7870
1
как то так
-------------
-------------
Приложения:

Ответил clinteastwood2
0
#include <iostream>
#include <string>
#include <sstream>
#include <unordered_set>
using namespace std;
typedef unordered_set<string> my_set;
int main()
{
string tmp, in = "hello world friend hello world hello";
my_set us;
stringstream ss;
ss << in;
while (ss >> tmp) us.insert(tmp);
for (auto i : us) cout << i << " ";
system("pause");
}
#include <string>
#include <sstream>
#include <unordered_set>
using namespace std;
typedef unordered_set<string> my_set;
int main()
{
string tmp, in = "hello world friend hello world hello";
my_set us;
stringstream ss;
ss << in;
while (ss >> tmp) us.insert(tmp);
for (auto i : us) cout << i << " ";
system("pause");
}
Новые вопросы