Skip to content

Instantly share code, notes, and snippets.

@4lex1v
Created September 28, 2012 21:22
Show Gist options
  • Save 4lex1v/3802144 to your computer and use it in GitHub Desktop.
Save 4lex1v/3802144 to your computer and use it in GitHub Desktop.
Задача 5 способ 2
program var_2;
type
row = array[1..15] of string;
var
data: row;
i, j: byte;
firstString: string;
secondString: string;
count: integer;
function compare(var fS: String; var sS: String): boolean;
begin
compare := fS = sS;
end;
begin
assign(input, 'inp.txt');
reset(input);
assign(output, 'out.txt');
rewrite(output);
for i:=1 to 15 do
begin
readln(data[i]);
end;
for i:=1 to 15 do
begin
writeln(data[i]);
end;
for i:=1 to 15 do
if data[i] <> '' then
begin
count := 1;
firstString := copy(data[i], 8, 11);
for j:=i+1 to 15 do
if data[j] <> '' then
begin
secondString := copy(data[j], 8, 11);
if compare(firstString, secondString) then
begin
data[j] := '';
count := count + 1;
end;
end;
writeln(firstString, ' - ', count);
end;
close(input);
close(output);
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment