View Code of Problem 98

#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	while(getline(cin,s)) {
		if(s=="</xmp>") break;
		if(s=="<xmp>") continue;
		int i1=s.find(">");
		int i2=s.find("<", i1);
		string name=s.substr(i1+1,i2-i1-1);
		string li,name2;
		int flag=0;//是否有货 
		for(int i=0; i<4; i++) {
			getline(cin,li);
			if(li.find("In Stock")!=-1) flag=1; 
		}
		if(flag) cout<<name<<endl; 
	}
}

Double click to view unformatted code.


Back to problem 98