program files;
var
s: string;
f, g: text;
n, maxn: integer;
maxl, i: byte;
begin
assign(f, 'ish.txt');
// первый проход, определяем строку макс длины
reset(f);
maxl := 0;
maxn := 0;
while not EoF(f) do
begin
readln(f, s);
inc(n);
if Length(s) > maxl then
begin
maxl := Length(s);
maxn := n
end
end;
// второй проход, запись второго файла
reset(f);
assign(g, 'pre.txt');
rewrite(g);
n := 0;
while not EoF(f) do
begin
readln(f, s);
inc(n);
if n = maxn then
begin // Помогите исправить
s[0] := #0;
for i := 1 to maxl do
if not(s[i] in ['+', '-']) then
s := s + s[i]
end;
writeln(g, s)
end;
close(f);
close(g);
end.