Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project2;
- {$APPTYPE CONSOLE}
- uses
- SysUtils;
- var
- words: array[0..9] of string[20];
- stroki: array[0..99] of string;
- stroka: array[0..255] of string;
- n, m, i, j, counter: integer;
- s: string;
- procedure check(str: string);
- var
- i: integer;
- begin
- for i:=0 to n-1 do if str=words[i] then
- begin
- inc(counter);
- words[i]:='.';
- end;
- end;
- begin
- readln(n);
- for i:=0 to n-1 do readln(words[i]);
- readln(m);
- for i:=0 to m-1 do readln(stroki[i]);
- counter:=0;
- for i:=0 to m-1 do begin
- //çàìåíÿåì çíàêè ïðåïèíàíèÿ ïðîáåëàìè
- for j:=1 to length(stroki[i]) do if (stroki[i][j]='!') or (stroki[i][j]='?') or (stroki[i][j]=',') or (stroki[i][j]='.') then stroki[i][j]:=' ';
- //óäàëÿåì äâîéíûå ïðîáåëû, åñëè îíè ïîëó÷èëèñü
- while pos(' ', stroki[i])>0 do delete(stroki[i], pos(' ', stroki[i]), 1);
- //óäàëÿåì ïðîáåëû ñ êîíöà ñòðîê, åñëè îíè òàì ïîëó÷èëèñü
- if stroki[i][length(stroki[i])]=' ' then delete(stroki[i], length(stroki[i]), 1);
- while pos(' ', stroki[i])>0 do begin
- s:=copy(stroki[i], 1, pos(' ', stroki[i])-1);
- delete(stroki[i], 1, pos(' ', stroki[i]));
- check(s);
- end;
- check(stroki[i]);
- end;
- writeln(counter);
- readln;
- end.
Add Comment
Please, Sign In to add comment