Cod sursa(job #90883)

Utilizator 7RaduRadu Antohi 7Radu Data 10 octombrie 2007 19:34:29
Problema Text Scor 90
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.83 kb
program Text1;
const
   abc : string = 'abcdefghijklmnoprstuvwxyzABCDEFGHJIKLMNOPRSTUVWXYZ';
var
   s, p, k : 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 prezent(c) then
            s := s + 1
         else
            if prezent(c1) then
               p := p + 1;
      end;
   Close(Fl);

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