Cod sursa(job #666982)

Utilizator caliman_alCaliman Alexandru caliman_al Data 22 ianuarie 2012 15:02:23
Problema Text Scor 90
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.63 kb
var n:array[1..100000] of char;
    i,s,k,j:integer;  f,g:text;
    l:integer;
begin
  assign(f,'text.in');
  assign(g,'text.out');
  reset(f);
  rewrite(g);

  l:=0;
  while (not eof(f)) do begin
    l:=l+1;
    read(f,n[l]);
  end;

  j:=1;
  while not (((n[j] >='a') and (n[j] <='z')) or ((n[j] >='A') and (n[j] <='Z')))
  do j:=j+1;

  for i:=j to l do
    if ((n[i] >='a') and (n[i] <='z')) or ((n[i] >='A') and (n[i] <='Z')) then
      k:=k+1 else
    if ((n[i+1] >='a') and (n[i+1] <='z')) or ((n[i+1] >='A') and (n[i+1] <='Z'))
      then s:=s+1;
  s:=s+1;

  writeln(g,k div s);
  close(f);
  close(g);
end.