-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathP11734.cpp
54 lines (48 loc) · 1.17 KB
/
P11734.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
50
51
52
53
54
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main() {
char judge[39], contestant[39];
int cases;
scanf("%d\n", &cases);
for(int cas = 1; cas <= cases; ++cas) {
gets(contestant);
gets(judge);
bool containsSpaces = false;
bool same = true;
int contestantI = 0;
int judgeI = 0;
for(int i = 0; contestant[i] != '\0'; ++i) {
if(!isalpha(contestant[i]))
containsSpaces = true;
else
contestant[contestantI++] = contestant[i];
}
contestant[contestantI] = '\0';
for(; judge[judgeI] != '\0'; ++judgeI) {
if(judge[judgeI] == contestant[judgeI])
continue;
//cerr << (int)judge[judgeI] <<"!="<< (int)contestant[judgeI] <<endl;
same = false;
break;
}
if(contestantI != judgeI)
same = false;
/*
cerr << contestant << endl;
cerr << judge << endl;
cerr << "cI=" << contestantI << ", jI=" << judgeI << endl;//*/
cout << "Case " << cas << ": ";
if(!same) {
cout << "Wrong Answer" << endl;
}
else if(containsSpaces) {
cout << "Output Format Error" << endl;
}
else {
cout << "Yes" << endl;
}
}
return 0;
}