-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgotten_lang.cpp
47 lines (42 loc) · 932 Bytes
/
forgotten_lang.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
#include <cstring>
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int n,k,flag = 0, a;
cin >> n >> k;
//n is no. of words and k is no. of phrases
char dict[n][6];
//storing words in the dictionary
for(int i = 0; i < n; i++)
{
cin >> dict[i];
}
//inputting the phrases
char p[k][50][5];
int g[k];
for(int i = 0; i < k; i++)
{
cin >> g[i]; //number of words in a phrase
for(int i = 0; i < a; i++)
{
cin >> p[k][i];
}
}
for(int p = 0; p < n; p++)
{
for(int i = 0; i < k; i++)
{
for(int j = 0; j < g[i]; j++)
{
if(strcmp(dict[p], p[i][j])==0)
flag = 1;
}
}
if(flag==1)
cout << "YES";
else
cout << "NO";
}
}