#include <iostream> #include <string> using namespace std; int main() { string des; string head; string name; int index1, index2; while (getline(cin, head)) { int flag = 0; if (head != "<xmp>" && head != "<xmp>") { index1 = head.find('>'); index2 = head.rfind('<'); name = head.substr(index1 + 1, index2 - index1 - 1); int i = 4; while (i--) { getline(cin, des); index1 = des.find("In Stock"); // 判断四行 if (index1 != des.npos) { flag = 1; } } if (flag) cout << name << endl; } } return 0; } |
Double click to view unformatted code.