forked from Mohammed-Shoaib/Coding-Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB0088.cpp
More file actions
36 lines (32 loc) · 640 Bytes
/
B0088.cpp
File metadata and controls
36 lines (32 loc) · 640 Bytes
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
// Problem Code: SIMDISH
#include <iostream>
#include <string>
#include <vector>
#include <unordered_set>
using namespace std;
string similarDishes(vector<string> A, vector<string> B) {
int count = 0;
unordered_set<string> set(A.begin(), A.end());
for(int i=0 ; i<B.size() ; i++)
if(set.find(B[i]) != set.end())
count++;
return (count >= 2) ? "similar" : "dissimilar";
}
int main(){
int T;
string s;
vector<string> A(4), B(4);
cin >> T;
while(T--) {
for(int i=0 ; i<4 ; i++) {
cin >> s;
A[i] = s;
}
for(int i=0 ; i<4 ; i++) {
cin >> s;
B[i] = s;
}
cout << similarDishes(A, B) << endl;
}
return 0;
}