Cod sursa(job #559681)

Utilizator GhitaRaulGhita Raul GhitaRaul Data 17 martie 2011 23:31:44
Problema Text Scor 60
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.45 kb
Program text1;
var  f:text;
     n,i,x:integer;
     s:string;
begin
n:=0;
x:=1;
assign(f,'text.in');reset(f);
While not eof(f) do begin
readln(f,s);
n:=n+length(s);
For i:=1 to length(s) do begin
If (s[i]=' ')and((s[i-1] in ['a'..'z'])or(s[i+1] in ['a'..'z'])or(s[i+1] in ['A'..'Z'])or(s[i-1]in['A'..'Z'])) then  x:=x+1;
If (s[i]<'A')or(s[i]>'z') then n:=n-1;
end;
    end;
assign(f,'text.out');rewrite(f);
writeln(f,n div  x);
close(f);
end.