-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuva496.cpp
64 lines (64 loc) · 1.27 KB
/
uva496.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
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <vector>
using namespace std;
int main(){
string A,B;
while(getline(cin,A) && getline(cin,B)){
vector<string>ansA,ansB;
string C,D;
int same=0;
for(int i=0;i<A.length();i++){
if(A[i]!=' '){
C+=A[i];
}else{
ansA.push_back(C);
C="";
}
}
ansA.push_back(C);
for(int i=0;i<B.length();i++){
if(B[i]!=' '){
D+=B[i];
}else{
ansB.push_back(D);
D="";
}
}
ansB.push_back(D);
for(int i=0;i<ansA.size();i++){
for(int j=0;j<ansB.size();j++){
if(ansA[i]==ansB[j]){
same++;
ansA[i]='g';
ansB[j]='c';
break;
}
}
}
if(ansA.size()>ansB.size()){
if(same==ansB.size()){
cout<<"B is a proper subset of A"<<endl;
}else if(same>0 && same<ansB.size()){
cout<<"I'm confused!"<<endl;
}else{
cout<<"A and B are disjoint"<<endl;
}
}else if(ansA.size()==ansB.size()){
if(same==ansA.size()){
cout<<"A equals B"<<endl;
}else if(same>0 && same<ansA.size()){
cout<<"I'm confused!"<<endl;
}else{
cout<<"A and B are disjoint"<<endl;
}
}else{
if(same==ansA.size()){
cout<<"A is a proper subset of B"<<endl;
}else if(same>0 && same<ansA.size()){
cout<<"I'm confused!"<<endl;
}else{
cout<<"A and B are disjoint"<<endl;
}
}
}
}