...
int num = 0;
string s = "";
string a = "";
getline(fin, s);
getline(fin, a);
while (s != "") {
if (s.find(str, 0) != 1) {
string konec = ".!?";
num = a.find_first_of(konec, 0);
cout << num;
string sub = a.substr(0, num);
if (sub.find(str, 0)) {
cout << sub << endl;
}
a.erase(0, num);
s.erase(0, num);
}
}
...