Входящий файл
4
Mario
Nensi
Gig
Joss
2
Joss
Nensi
Выходной файл:
Mario
Gig
program lab;
var
f: text;
st2, st, st1: array [1 .. 50] of string;
h, j, n, k, i: integer;
label 1;
begin
assign(f, 'input.txt');
reset(f);
readln(f, n);
for i := 1 to n do
begin
readln(f, st[i]);
end;
readln(f, k);
for i := 1 to k do
begin
readln(f, st1[i]);
end;
for i := 1 to n do
begin
for j := 1 to n do
begin
if st[i] = st1[j] then
goto 1;
end;
h := h + 1;
st2[h] := st[i];
1:
end;
close(f);
assign(f, 'output.txt');
rewrite(f);
for i := 1 to h do
begin
writeln(f, st2[i]);
end;
close(f);
end.