Cod sursa(job #2336413)

Utilizator danielavornicDaniela Vornic danielavornic Data 5 februarie 2019 09:13:07
Problema Text Scor 20
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.63 kb
//program text;
//uses crt;
var f : textfile;
    text : string;
    i, nrCuv, l : integer;
begin
   assign(f, 'text.in');
   reset(f);
   read(f, text);
   close(f);

   l := length(text);
   nrCuv := 0;
   for i:=1 to length(text) do
   begin
      if not (text[i] in ['a'..'z','A'..'Z']) then l:= l-1;
      if ((text[i] = ' ') or (text[i] = '-')) and ((text[i-1] in ['a'..'z','A'..'Z']) or (text[i+1] in ['a'..'z','A'..'Z']))then inc(nrCUV);
   end;

   {clrscr;
   writeln(l);
   writeln(nrCuv);
   writeln(trunc(l/nrCuv));  }
   assign(f, 'text.out');
   rewrite(f);
   write(f, trunc(l/nrcuv));
   close(f);
end.