program txt2dat;
var
	f:text;
	g:file;
	s:string[255];
	l:byte;
	w:word;
begin
	if paramstr(2)='' then begin
		writeln('txt2dat infile outfile');
	end else begin
		assign(f,paramstr(1));
		assign(g,paramstr(2));
		reset(f);
		rewrite(g,1);
		while not eof(f) do begin
			readln(f,s);
			if s='' then halt;
			l:=length(s);
			if s[l]=#$d then dec(l);
			blockwrite(g,l,1,w);
			blockwrite(g,s[1],l,w);
		end;
	end;
end.