#include<string> #include<algorithm> #include<iostream> using namespace std; int main(){ string s; int d; string name; bool flag; while(getline(cin,s) && s!="</xmp>"){ string f=s.substr(0,4); if(f=="<h3 "){ flag=false; s.erase(0,1); d=0; name=s.substr(s.find('>')+1,s.find('<')-s.find('>')-1); } else if(f=="<li>"){ d++; if(s.find("In Stock")!=s.npos){ flag=true; } if(d==4){ if(flag){ cout<<name<<endl; } } } } } |
Double click to view unformatted code.