Cod sursa(job #94293)

Utilizator 7RaduRadu Antohi 7Radu Data 22 octombrie 2007 16:26:53
Problema Text Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.96 kb
program Text1;
const
   abc : string = 'abcdefghijklmnoprstuvwxyzABCDEFGHJIKLMNOPRSTUVWXYZ';
var
   s, p, p1 : longint;
   c, c1 : char;
   Fl : text;

function prezent(in1: char): boolean;
var
   i : longint;
begin
   prezent := false;
   for i := 1 to length(abc) do
      if abc[i] = in1 then
         begin
           prezent := true;
           Exit;
         end;
end;
begin
   Assign(Fl,'text.in');
   Reset(Fl);
   p := 0;
   s := 0;
   Read(Fl,c);
   if prezent(c) then
      s := 1;
   while not eof(Fl) do
      begin
         c1 := c;
         Read(Fl,c);
         if c = ' ' then
            WriteLn('spatiu') else
         WriteLn(c);
         if prezent(c) then
            s := s + 1
         else
            if ((prezent(c1)) and (c = ' ')) or (not eof(Fl)) then
               p := p + 1;
      end;
   Close(Fl);


   Assign(Fl,'text.out');
   ReWrite(Fl);
   WriteLn(Fl,s div p);
   Close(Fl);

   ReadLn;
end.