#include #include #include #include using namespace std; bool matchStr (string pat, string inp) { int i, j; for (i=j=0; inp[i] && pat[j]; ) { if (tolower(inp[i]) == tolower(pat[j])) { while (inp[i] && pat[j] && tolower(inp[i]) == tolower(pat[j])) { i++, j++; } j--; if (tolower(inp[i]) == tolower(pat[j])) { while (tolower(inp[i]) == tolower(pat[j])) { i++; } } j++; } else { return false; } } if (!inp[i] && !pat[j]) return true; return false; } int countKeywords(string subjectLine, vector keywords) { string inp; int ans; ans = 0; for (int i=0; subjectLine[i]; i++) { inp=""; for ( ;subjectLine[i] && subjectLine[i] !=' '; i++) { inp += subjectLine[i]; } for (vector::iterator it = keywords.begin(); it!=keywords.end(); it++) { if (matchStr(*it, inp)) { cout<<*it<<" "< keywords; cin.getline(arr, 99); subjectLine = arr; while (cin>>tmp) { if (tmp=="0") break; if (find (keywords.begin(), keywords.end(), tmp) == keywords.end()) keywords.push_back(tmp); } cout<