Cod sursa(job #678044)

Utilizator smotruSergiu Falcusan smotru Data 10 februarie 2012 22:30:21
Problema Text Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.59 kb
program text_infoarena;
type sir = array[1..100000] of char;
var a:sir;
    i,n:longint;
    f:text;
    lungime,nr_cuvinte:integer;

begin
  assign(f,'text.in'); reset(f);
  i:=1;
  while not eof(f) do
  begin
    read(f,a[i]);
    inc(i);
  end;
  close(f);
  n:=i-1;
  for i:=1 to n do begin
    a[i]:=upcase(a[i]);
    if not (a[i] in ['A'..'Z','0'..'9']) then a[i]:=' ';
  end;

  nr_cuvinte:=0;
  lungime:=0;
  for i:=1 to n do begin
    if (a[i] in ['A'..'Z','0'..'9']) then inc(lungime) else inc(nr_cuvinte);
  end;
  writeln (lungime div nr_cuvinte+1);
  readln;
end.