programm fsdfs;
var
f1, f2, f3: textfile;
i: integer;
c: char;
begin
assignfile(f1, 'aa.txt');
assignfile(f2, 'bb.txt');
assignfile(f3, 'cc.txt');
reset(f1);
rewrite(f2);
rewrite(f3);
i := 0;
while not(Eof(f1)) do
begin
read(f1, c);
case c of
' ':
begin
i := 1;
write(f2, #13#10);
end;
#10:
continue; //Пропустить этот служебный символ
#13:
begin
i := 0; //Перейти на первый файл
write(f3, #13#10); //Дописать перенос строки.
end;
else
if i = 0 then
write(f2, c)
else
write(f3, c);
end;
end;
closefile(f1);
closefile(f2);
closefile(f3);
end;
cHJvZ3JhbW0gZnNkZnM7CnZhcgogIGYxLCBmMiwgZjM6IHRleHRmaWxlOwogIGk6IGludGVnZXI7CiAgYzogY2hhcjsKCmJlZ2luCiAgYXNzaWduZmlsZShmMSwgJ2FhLnR4dCcpOwogIGFzc2lnbmZpbGUoZjIsICdiYi50eHQnKTsKICBhc3NpZ25maWxlKGYzLCAnY2MudHh0Jyk7CgogIHJlc2V0KGYxKTsKICByZXdyaXRlKGYyKTsKICByZXdyaXRlKGYzKTsKICBpIDo9IDA7CiAgd2hpbGUgbm90KEVvZihmMSkpIGRvCiAgYmVnaW4KICAgIHJlYWQoZjEsIGMpOwogICAgY2FzZSBjIG9mCiAgICAgICcgJzoKICAgICAgICBiZWdpbgogICAgICAgICAgaSA6PSAxOwogICAgICAgICAgd3JpdGUoZjIsICMxMyMxMCk7CiAgICAgICAgZW5kOwogICAgICAjMTA6CiAgICAgICAgY29udGludWU7IC8v0J/RgNC+0L/Rg9GB0YLQuNGC0Ywg0Y3RgtC+0YIg0YHQu9GD0LbQtdCx0L3Ri9C5INGB0LjQvNCy0L7QuwogICAgICAjMTM6CiAgICAgICAgYmVnaW4KICAgICAgICAgIGkgOj0gMDsgLy/Qn9C10YDQtdC50YLQuCDQvdCwINC/0LXRgNCy0YvQuSDRhNCw0LnQuwogICAgICAgICAgd3JpdGUoZjMsICMxMyMxMCk7IC8v0JTQvtC/0LjRgdCw0YLRjCDQv9C10YDQtdC90L7RgSDRgdGC0YDQvtC60LguCiAgICAgICAgZW5kOwogICAgZWxzZQogICAgICBpZiBpID0gMCB0aGVuCiAgICAgICAgd3JpdGUoZjIsIGMpCiAgICAgIGVsc2UKICAgICAgICB3cml0ZShmMywgYyk7CiAgICBlbmQ7CgogIGVuZDsKICBjbG9zZWZpbGUoZjEpOwogIGNsb3NlZmlsZShmMik7CiAgY2xvc2VmaWxlKGYzKTsKCmVuZDs=