Cod sursa(job #41827)

Utilizator savimSerban Andrei Stan savim Data 28 martie 2007 16:54:35
Problema Text Scor 80
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.61 kb
var f1,f2:text;
    lc,nc,i:longint;
    t,q:char;
begin
assign(f1,'text.in');
assign(f2,'text.out');
reset(f1);
rewrite(f2);
nc:=0;lc:=0;
read(f1,t);
{if ((t>='a') and (t<='z')) or ((t>='A') and (t<='Z')) then lc:=lc+1;}
while not eof(f1) do
 begin
  read(f1,q);
  if (((q>='a') and (q<='z')) or ((q>='A') and (q<='Z'))) and
     ((t<'A') or ((t>'Z') and (t<'a')) or (t>'z')) then nc:=nc+1;
  if ((q>='a') and (q<='z')) or ((q>='A') and (q<='Z')) then lc:=lc+1;
  t:=q;
 end;
if (lc<>0) and (nc=0) then nc:=nc+1;
if nc=0 then writeln(f2,0)
        else writeln(f2,lc div nc);
close(f1);
close(f2);
end.