Cod sursa(job #1591293)

Utilizator prisacalexandruPrisac Alexandru prisacalexandru Data 5 februarie 2016 23:13:16
Problema Text Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.59 kb
Program text1;
Var fi,fo:text;
    s:ansistring;
    i,k,m:integer;

Begin
assign(fi,'text.in');
assign(fo,'text.out');
reset(fi);
s:=' ';
while not(eof(fi)) do read(fi,s);
close(fi);
rewrite(fo);
for i:=1 to length(s) do begin
                         if (s[i]>='A')and(s[i]<='Z') then inc(k);
                         if (s[i]>='a')and(s[i]<='z') then inc(k);
                         if (s[i]='-')or(s[i]=' ') then inc(m);
                         end;
if (s[1]='-')and(s[2]=' ') then dec(m,2);
if (s[1]=' ')and(s[2]='-') then dec(m,2);
Write(fo,k div(m+1) );
close(fo);
end.