Cod sursa(job #408079)

Utilizator ivanhoeNociv Hasis ivanhoe Data 2 martie 2010 20:31:05
Problema Text Scor 20
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.59 kb
var
 s:string;
 c,i,l,gasit:byte;
 f:text;
procedure citire;
var
 f:text;
begin
 assign(f,'text.in');
 reset(f);
 readln(f,s);
 close(f);
end;
begin
 citire;
 i:=0;
 l:=0;
 c:=0;
 gasit:=0;
 Repeat
  i:=i+1;
  if upcase(s[i]) in  ['A'..'Z']
   then
    if gasit=0
     then
      gasit:=1
    else
   else
   if gasit=1
    then
     begin
      gasit:=0;
      c:=c+1;
     end;
 until i>length(s);
 for I:=1 to length(s) do
  if upcase(s[i]) in ['A'..'Z']
   then
    l:=l+1;
 assign(f,'text.out');
 rewrite(f);
 writeln(f,l div c);
 close(f);
end.