Cod sursa(job #331474)

Utilizator danalex97Dan H Alexandru danalex97 Data 14 iulie 2009 10:03:52
Problema Text Scor 60
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.73 kb
type fraza=array[1..100000] of char;
var a:fraza;
    ok,ok2:boolean;
    f,g:text;
    i,c,c2:integer;

procedure elitera(i:integer; a:fraza; var ok:boolean);
begin
if ((ord(a[i])>=97)and(ord(a[i])<=122))or((ord(a[i])>=65)and(ord(a[i])<=90)) then ok:=true
                                                                              else ok:=false;
end;

begin
assign(f,'text.in');
reset(f);
assign(g,'text.out');
rewrite(g);
i:=0;
ok:=false;
ok2:=ok;
c:=0;
c2:=0;
while (a[i]<>#26)or(a[i-1]<>#26)or(a[i-1]<>#26) do
  begin
    ok2:=ok;
    inc(i);
    read(f,a[i]);
    elitera(i,a,ok);
    if ok then inc(c);
    if (ok=true) and (ok2=false) then inc(c2);
  end;
write(g,c div c2);
close(f);
close(g);
end.