Cod sursa(job #256576)

Utilizator botaMihai Botezatu Catalin bota Data 11 februarie 2009 21:48:20
Problema Text Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.65 kb
var  md,j,u,nr,nr1,nr2,i:longint;
     c:char;
     a:array[1..10000] of char;
     k,l:text;
begin
assign(k,'text.in');
reset(k);
assign(l,'text.out');
rewrite(l);
while not eof(k) do begin
read(k,c);
i:=i+1;
a[i]:=c;
end;
for j:=1 to i do begin
if (a[j]=' ')or(a[j]='-')or(a[j]='!')or(a[j]='.')or(a[j]='?')or(a[j]='...')or(a[j]='" ')or(a[j]=';') then nr:=nr+1;
if nr=2 then begin nr1:=nr1+1;nr:=1; end;
if (a[j]<>' ')and(a[j]<>'-')and(a[j]<>'?')and(a[j]<>'!')and(a[j]<>'.')and(a[j]<>',')and(a[j]='" ')and(a[j]=';') then nr2:=nr2+1;
if (nr=2)and(a[j]=' ')and(a[j-2]=' ')then nr:=nr-1;
end;
md:=nr2 div nr1;
write(l,md);
close(k) ;
close(l);
end.