Skip to content

Instantly share code, notes, and snippets.

@satellitex
Created July 13, 2014 16:52
Show Gist options
  • Save satellitex/2255348897726acbfd30 to your computer and use it in GitHub Desktop.
Save satellitex/2255348897726acbfd30 to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
int N;
char buf[65536];
int main(){
while( fgets(buf,sizeof(buf),stdin) != '\0'){
string S = buf;
string search1 = "<div class=\"qtext\">";
int id;
if( (id = S.find( search1 )) != (int)string::npos ) {
string sub = S.substr( id + search1.size() );
string q = sub.substr(0, sub.find("</div>"));
cout << "question::" << endl;
cout << q << endl;
string search2 ="The correct answer is: ";
while( fgets(buf,sizeof(buf),stdin) != '\0' ) {
S = buf;
if( (id = S.find( search2 )) != (int)string::npos) {
sub = S.substr( id + search2.size() );
string ans = sub.substr(0, sub.find("</div>"));
cout << "answer 1" << endl;
cout << ans << endl << endl;
break;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment