Cod sursa(job #331471)

Utilizator danalex97Dan H Alexandru danalex97 Data 14 iulie 2009 09:53:46
Problema Text Scor 50
Compilator fpc Status done
Runda Arhiva de probleme Marime 1.93 kb
type fraza=array[1..1003] 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 (a[i]='q')or(a[i]='w')or(a[i]='e')or(a[i]='r')or(a[i]='t')or(a[i]='y') then ok:=true
                                                                          else
if (a[i]='u')or(a[i]='i')or(a[i]='o')or(a[i]='p')or(a[i]='a')or(a[i]='s') then ok:=true
                                                                          else
if (a[i]='d')or(a[i]='f')or(a[i]='g')or(a[i]='h')or(a[i]='j')or(a[i]='k') then ok:=true
                                                                          else
if (a[i]='l')or(a[i]='z')or(a[i]='x')or(a[i]='c')or(a[i]='v')or(a[i]='b')or(a[i]='n')or(a[i]='m')  then ok:=true
                                                                                                   else
if (a[i]='Q')or(a[i]='W')or(a[i]='E')or(a[i]='R')or(a[i]='T')or(a[i]='Y') then ok:=true
                                                                          else
if (a[i]='U')or(a[i]='I')or(a[i]='O')or(a[i]='P')or(a[i]='A')or(a[i]='S') then ok:=true
                                                                          else
if (a[i]='D')or(a[i]='F')or(a[i]='G')or(a[i]='H')or(a[i]='J')or(a[i]='K') then ok:=true
                                                                          else
if (a[i]='L')or(a[i]='Z')or(a[i]='X')or(a[i]='C')or(a[i]='V')or(a[i]='B')or(a[i]='N')or(a[i]='M')  then ok:=true
                                                                                                   else
ok:=false;
end;

begin
assign(f,'text.in');
reset(f);
assign(g,'text.out');
rewrite(g);
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.