#include <iostream>
#include <regex>
#include <fstream>
#include <string>
using namespace std;
int main() {
ifstream fin("f");
string s = "", _temp;
while (getline(fin, _temp))
s += _temp;
fin.close();
ofstream fout("g");
try {
regex re("[a-z]");
sregex_iterator next(s.begin(), s.end(), re);
sregex_iterator end;
while (next != end) {
smatch match = *next;
fout << match.str();
next++;
}
catch (regex_error& e) {
cout << "smth went wrong.";
fout.close();
#include <iostream>
#include <regex>
#include <fstream>
#include <string>
using namespace std;
int main() {
ifstream fin("f");
string s = "", _temp;
while (getline(fin, _temp))
s += _temp;
fin.close();
ofstream fout("g");
try {
regex re("[a-z]");
sregex_iterator next(s.begin(), s.end(), re);
sregex_iterator end;
while (next != end) {
smatch match = *next;
fout << match.str();
next++;
}
}
catch (regex_error& e) {
cout << "smth went wrong.";
}
fout.close();
}