View Code of Problem 98

#include<bits/stdc++.h>
using namespace std;
int main()
{
	string str;
	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){
			for (int i = 0; i < name.length(); i++){
				cout << name[i];
				if(i==name.length()-1)
					cout<<endl; 
			}
		
		}
			
	}
}

Double click to view unformatted code.


Back to problem 98