Judge:Help/check.cpp
From PEGWiki
#include <iostream> #include <sstream> #include <fstream> #include <vector> using namespace std; vector<string> split(string& s) { vector<string> vs; istringstream sin(s); while (sin >> s) vs.push_back(s); return vs; } bool Getline(ifstream& f, vector<string>& s) { while (s.empty()) { string str; if (!getline(f, str)) return false; s = split(str); } return true; } int main(int argv, char ** argc) { ifstream F(argc[1]); ifstream G(argc[2]); bool a, b; vector<string> s, t; do { s = vector<string>(); t = s; a = Getline(F, s); b = Getline(G, t); if (a ^ b) return 1; if (a && b && s != t) return 1; } while (a && b); return 0; }