Pagini recente » Cod sursa (job #2451354) | Cod sursa (job #1098007) | Cod sursa (job #2376277) | Cod sursa (job #1848681) | Cod sursa (job #543266)
Cod sursa(job #543266)
var
f,g:text;
//cuv:array[1..20000]of string;
buf:array[1..1 shl 15] of char;
ncuv,nlit:integer;
st:string;
c:char;
begin
assign(f,'text.in');reset(f);
assign(g,'text.out');rewrite(g);
settextbuf(f,buf);
while not eof do
begin
read(f,c ); st := '';
while (c >= 'a') and (c <= 'z')or (c>='A') and (c<='Z') do
begin
st := st + c;
read( c );
inc( nlit );
end;
if st <> '' then inc( ncuv );
end;
writeln(g,nlit div ncuv );
{ncuv:=0;
while not seekeof(f) do
begin
readln(f,s);
//if s='' then continue;
//while s[1]=' ' do delete(s,1,1);
//while s[length(s)]=' ' do delete(s,length(s),1);
for i:=1 to length(s) do
if (s[i]<'a') and (s[i]>'z') or (s[i]>'A') and (s[i]<'Z') then
delete(s,i,1);
i:=pos(' ',s);
while i<>0 do
begin
inc(ncuv);
cuv[ncuv]:=copy(s,1,i-1);
sol:=sol+length(cuv[ncuv]);
delete(s,1,i);
i:=pos(' ',s)
end;
inc(ncuv);
cuv[ncuv]:=s;
sol:=sol+length(cuv[ncuv]);
end;
i:=1;
repeat
write(g,cuv[i],' ');
inc(i);
until i=ncuv;
write(g,ncuv,' ',sol);
}
close(f);close(g);
end.