-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlcmp.cpp
49 lines (37 loc) · 924 Bytes
/
lcmp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "testlib.h"
#include <string>
#include <vector>
#include <sstream>
using namespace std;
bool compareWords(string a, string b) {
vector<string> va, vb;
stringstream sa;
sa << a;
string cur;
while (sa >> cur)
va.push_back(cur);
stringstream sb;
sb << b;
while (sb >> cur)
vb.push_back(cur);
return (va == vb);
}
int main(int argc, char * argv[]) {
inf.init(argv[1], _input);
ouf.init(argv[2], _output);
ans.init(argv[3], _answer);
std::string strAnswer;
while (!ans.eof()) {
string jj = ans.readString();
if (jj == "" && ans.eof())
break;
string pp = ouf.readString();
strAnswer = pp;
if (!compareWords(jj, pp)) {
cout << "Incorrect" << endl << "0" << endl;
return 0;
}
}
cout << "Correct" << endl << "100" << endl;
return 0;
}