#include<iostream> #include<vector> #include<algorithm> #include<string> #include<climits> #include<cmath> #include<unordered_map> #include<set> using namespace std; int main() { string str; vector<string> goods; while (getline(cin, str)) { if (str == "</xmp>") break; if (str == "<xmp>") continue; int begin = str.find('>'); int end = str.find('<', begin); string name = str.substr(begin + 1, end - begin - 1); int flag = 0; for (int i = 0; i < 4; i++) { string info; getline(cin, info); if (info.find("In Stock") != info.npos) { flag = 1; } } if (flag == 1) goods.push_back(name); } for (int i = 0; i < goods.size(); i++) cout << goods[i] << endl; } |
Double click to view unformatted code.