Cod sursa(job #2339067)

Utilizator RegecampfAlex Vartic Regecampf Data 8 februarie 2019 12:24:51
Problema Text Scor 50
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.61 kb
const 
bk=['A'..'Z','a'..'z'];
procedure Bukva(i:byte;s:string;var k:byte);
begin
if s[i] in bk then inc(k);
if i<length(s) then Bukva(i+1,s,k);
end;
 
var s,d:string;
    i,k:byte;
    count:integer;
    z:integer;
    c:real;
    t,f:text;
begin
assign(t,'text.in');
assign(f,'text.out');
reset(t);
rewrite(f);
readln(t,s);
i:=1;k:=0;
Bukva(i,s,k);
count:=0;
s := ' ' + s;
for z := 1 to length(s) - 1 do
  if (s[z] = ' ') and (s[z + 1] <> ' ') then
    count := count + 1;
    writeln;
    writeln(count);
    c:=k/count;
    writeln(f,int(c));
    close(f);
    close(t);
    
end.