Cod sursa(job #425936)

Utilizator C0Mr4d3yonootz321 C0Mr4d3 Data 26 martie 2010 11:51:42
Problema Text Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.7 kb
program text1;
var f:text;
    nl,nc,c,i:word;
    a:array[1..1000000] of char;

function eLitera(x:char):boolean;
begin
  if (upcase(x)>='A') and (upcase(x)<='Z') then
    eLitera:=true
  else
    eLitera:=false;
end;

begin
  assign(f,'text.in');
  reset(f);
  nc:=0;
  nl:=0;
  c:=0;
  while not eof(f) do
   begin
    while not eoln(f) do
      begin
        c:=c+1;
        read(f,a[c]);
      end;
    readln(f);
   end;
  for i:=1 to c do
    if eLitera(a[i]) then
      nl:=nl+1
    else
      if (i>1) and (eLitera(a[i-1])) then
        nc:=nc+1;
  close(f);
  assign(f,'text.out');
  rewrite(f);
  writeln(f,nl,' ',nc);
  writeln(f,nl div nc);
  close(f);
end.