#include <iostream>
#include <fstream>
#include <string>
#include <set>
using namespace std;
int main() {
ifstream file("C:\\Users\\****\\Downloads\\ифе\\npc_abilities.txt"); // Путь к файлу откуда брать
ifstream no("C:\\Users\\****\\Downloads\\ифе\\no.txt"); // Путь к файлу исключений
ofstream output("C:\\Users\\****\\Downloads\\ифе\\output.txt"); // Путь к файлу куда сохранить результат
set<string> unique_strings;
set<string> exceptions;
string line;
// Считываем исключения из файла no.txt
if (no.is_open()) {
while (getline(no, line)) {
exceptions.insert(line);
}
no.close();
}
else {
cout << "Unable to open file no.txt" << endl;
}
// Ищем уникальные строки в файле npc_abilities.txt
if (file.is_open()) {
while (getline(file, line)) {
size_t pos = line.find("\"");
if (pos != string::npos) {
size_t endpos = line.find("\"", pos + 1);
if (endpos != string::npos) {
string found = line.substr(pos + 1, endpos - pos - 1);
// Проверяем, не является ли строка словом-исключением
if (exceptions.find(found) == exceptions.end()) {
unique_strings.insert(found);
}
}
}
}
file.close();
// Перебираем уникальные строки и записываем их в файл output.txt
for (auto it = unique_strings.begin(); it != unique_strings.end(); ++it) {
output << *it << endl;
}
output.close();
}
else {
cout << "Unable to open file npc_abilities.txt" << endl;
}
return 0;
}