Cod sursa(job #151755)

Utilizator ghitza_2000Stefan Gheorghe ghitza_2000 Data 8 martie 2008 16:24:58
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.47 kb
var a,b,ct,S,d:longint;
    i,c1,h:char;
    f,g:text;
    m:set of char;
begin
assign(f,'text.in'); reset(f);
for i:='a' to 'z' do
m:=m+[i];
h:='0';
d:=0;
for i:='A' to 'Z' do
m:=m+[i];
while (not eoln(f)) do
begin
read(f,c1);
if (([c1]*m=[]) and (d<>0)) then inc(ct);
if [c1]*m<>[] then begin
d:=d+1;
inc(S);
h:=c1;
end
else d:=0;
end;
close(f);
assign(g,'text.out'); rewrite(g);
if ct=0 then writeln(g,'0')
else
writeln(g,S div ct);
close(g);
end.