Cod sursa(job #13694)

Utilizator floringh06Florin Ghesu floringh06 Data 7 februarie 2007 13:28:04
Problema Text Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 1.44 kb


type as=ansistring;
var fi,fo:text;
    a,s:as;
    nc,nl,rez:longword;
          ok:boolean;
           c:char;


{ procedure solve;
  var i:longword;
   begin
     i:=1;
     nc:=1;
     while pos('-',s)<>0 do
       begin
        if s[pos('-',s)+1] in[('a')..('z'),('A')..('Z')] then inc(nc);
        delete(s,pos('-',s),1);
       end;
     while i<=length(s) do
       if not (s[i] in[('a')..('z'),('A')..('Z')]) and
         (s[i]<>' ') then
         delete(s,i,1)
          else inc(i);


     while pos(' ',s) =1 do
       delete(s,1,1);
     ok:=false;

     while pos(' ',s) <>0 do
         begin
           c:=pos(' ',s);
           if s[c+1]<>' ' then inc(nc);
           delete(s,c,1);
         end;
     nl:=length(s);
     rez:=trunc(nl/nc);
    end;
}
 procedure solve;
   var i:longword;
    begin
     nc:=0;
     nl:=0;
     i:=1;
     while not eoln(fi) do
      begin
        read(fi,c);
       if c in [('a')..('z'),('A')..('Z')] then
        begin
          inc(nc);
          while c in [('a')..('z'),('A')..('Z')] do
            begin
             inc(nl);
             read(fi,c);
            end;
         end;
       end;
       if nc<>0 then  rez:=trunc(nl/nc)
            else rez:=0;
    end;





begin
 assign(fi,'text.in'); reset(fi);
 assign(fo,'text.out'); rewrite(fo);
 solve;
 writeln(fo,nl);
 writeln(fo,nc);
 writeln(fo,rez);
close(fi);
close(fo);
end.