Cod sursa(job #393604)
Utilizator | Dutescu Radu Alin tiger_10 | Data | 9 februarie 2010 18:38:00 |
---|---|---|---|
Problema | Text | Scor | 80 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 1.16 kb |
var f,g:text;
c:char;
k,l:longint;
ok:boolean;
begin
assign(f,'text.in');
reset(f);
k:=0;
l:=0;
ok:=true;
while not eof(f) do begin
read(f,c);
if ((ord(c)<65)or(ord(c)>90))and((ord(c)<97)or(ord(c)>122))and(k=0) then begin
ok:=false;
k:=0;
end
else
if k=0 then k:=1;
if (ok=true)and((ord(c)<65)or(ord(c)>90))and((ord(c)<97)or(ord(c)>122)) then begin
inc(k);
ok:=false;
end
else
if ((ord(c)>=65)and(ord(c)<=90))or((ord(c)>=97)and(ord(c)<=122)) then
begin
inc(l);
ok:=true;
end;
end;
if (ok=false)and(c=' ') then dec(k);
close(f);
assign(g,'text.out');
rewrite(g);
writeln(g,l div k);
close(g);
end.