Cod sursa(job #331480)

Utilizator danalex97Dan H Alexandru danalex97 Data 14 iulie 2009 10:16:04
Problema Text Scor 100
Compilator fpc Status done
Runda Arhiva de probleme Marime 1.71 kb
var a,a2:char;
    ok,ok2:boolean;
    f,g:text;
    i,c,c2:integer;
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<>#26)or(a2<>#26) do
  begin
    a2:=a;
    ok2:=ok;
    read(f,a);
if (a='q')or(a='w')or(a='e')or(a='r')or(a='t')or(a='y') then ok:=true
                                                                          else
if (a='u')or(a='i')or(a='o')or(a='p')or(a='a')or(a='s') then ok:=true
                                                                          else
if (a='d')or(a='f')or(a='g')or(a='h')or(a='j')or(a='k') then ok:=true
                                                                          else
if (a='l')or(a='z')or(a='x')or(a='c')or(a='v')or(a='b')or(a='n')or(a='m')  then ok:=true
                                                                                                   else
if (a='Q')or(a='W')or(a='E')or(a='R')or(a='T')or(a='Y') then ok:=true
                                                                          else
if (a='U')or(a='I')or(a='O')or(a='P')or(a='A')or(a='S') then ok:=true
                                                                          else
if (a='D')or(a='F')or(a='G')or(a='H')or(a='J')or(a='K') then ok:=true
                                                                          else
if (a='L')or(a='Z')or(a='X')or(a='C')or(a='V')or(a='B')or(a='N')or(a='M')  then ok:=true
                                                                                                   else
ok:=false;
    if ok then inc(c);
    if (ok=true) and (ok2=false) then inc(c2);
  end;
if c2<>0 then write(g,c div c2)
         else write(g,'0');
close(f);
close(g);
end.