Cod sursa(job #153118)

Utilizator nod_softwareBudisteanu Ionut Alexandru nod_software Data 10 martie 2008 10:09:46
Problema Text Scor 60
Compilator fpc Status done
Runda Arhiva de probleme Marime 1.58 kb
program text2;
{$APPTYPE CONSOLE}
uses
  SysUtils;
var fin,fout:text;
    i,j,lit,cuv:integer;
    ok:boolean;
    c:char;
begin
  assign(fin,'text.in');
  assign(fout,'text.out');
  reset(fin);
  rewrite(fout);
  cuv:=0;
  lit:=0;
  ok :=false;
  while not eof(fin) do
    begin
      i:=0;
      while not eoln(fin) do
        begin
          inc(i);
          read(fin,c);
          if (i= 1) and (c <>'-') then inc(cuv);
          case c of
            ' ':inc(cuv);
            '-':if i > 1 then inc(cuv);
{            '!':
              begin
                inc(cuv);
                j:=i;
                ok:=true;
              end;
            '.':
              Begin
                inc(cuv);
                j:=i;
                ok:=true;
              End;
            '?':
              Begin
                inc(cuv);
                j:=i;
                ok:=true;
              End;
            ':':inc(cuv);
            '_':inc(cuv); }
            '''':inc(cuv);
            '"':if i < 2 then inc(cuv);
            'a'..'z':inc(lit);
            'A'..'Z':inc(lit);
            '0'..'9':inc(lit);
            '>':inc(cuv);
            '<':inc(cuv);
            '=':inc(cuv);
            ']':inc(cuv);
            '[':inc(cuv);
            '}':inc(cuv);
            '{':inc(cuv);
            '\':inc(cuv);
            '/':inc(cuv);
            '(':inc(cuv);
            ')':inc(cuv);
          end;
        end;
      readln(fin);
    end;
  if j <> i then ok :=false;
  if ok then dec(cuv);
  writeln(fout,lit div cuv);
//  writeln(fout,lit div cuv,'   ',lit,'   ',cuv);
  close(fout);
end.