Cod sursa(job #728961)

Utilizator TavissSalcianu Octavian Taviss Data 29 martie 2012 09:48:02
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.49 kb
var f:text;
    cl,cw,mid:longint;
    c:char;
    nc:boolean;

const ALFABET = ['A'..'Z', 'a'..'z'];

begin
cl:=0;
cw:=0;
nc:=false;
assign(f, 'text.in');
reset(f);
while not EOF(f) do begin
read(f, c);
if c in ALFABET then begin
cl:=cl+1;
nc:=true;
end
else if nc=true then begin
cw:=cw+1;
nc:=false;
end;
if(EOF(f)) AND (nc=true) then cw:=cw+1;
end;
close(f);
assign(f, 'text.out');
rewrite(f);
if(cw > 0) then begin
mid:=cl div cw;
write(f, mid);
end;
close(f);
end.