Cod sursa(job #758544)

Utilizator andrei_toaderToader Andrei Sorin andrei_toader Data 15 iunie 2012 22:40:02
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.58 kb
program textaha;
var f,g:text;
    s:ansistring;
    i,litere,cuvinte:longint;

begin
 assign (f,'text.in'); reset (f);
 assign (g,'text.out'); rewrite (g);
 read (f,s);
 litere:=0;
 cuvinte:=0;
 for i:=1 to length (S) do
 begin
  if (s[i]>='A') and (s[i]<='z') then
   inc(litere);
  if (i<>1) and  ((s[i]<'A') or (s[i]>'z')) and ((s[i-1]>='A') and (s[i-1]<='z')) then
   inc(cuvinte);
 end;
 if (s[length (s)]>='A') and (s[length(s)]<='z') then
  inc(cuvinte);
  if cuvinte=0 then
   write (g,0)
  else
 write (G,trunc(litere/cuvinte));
 close (F); close (G);
end.