Cod sursa(job #1533358)

Utilizator cristionCristian Boicu cristion Data 22 noiembrie 2015 14:06:46
Problema Text Scor 30
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.61 kb
program p2;
var s:string;
a,n,i,e,x :integer;
f,g:text;
j:real;
begin
assign (f,'text.in');
reset (f);
assign (g,'text.out');
rewrite (g);
read (f,s);
n:=1;
for i:=1 to length(s) do
If not (s[i] in ['a'..'z','A'..'Z']) then s[i]:='$';
for i:=1 to length(s) do begin
If (s[i] in ['a'..'z','A'..'Z']) and (s[i+1]='$') then
begin
for e:=i+1 to length(s) do begin
If s[e] in ['a'..'z','A'..'Z'] then x:=x+1;
end;
IF x>0 then n:=n+1
       else n:=n;
       end;
If s[i] in ['a'..'z'] then a:=a+1;
If s[i] in ['A'..'Z'] then a:=a+1;
end;
j:=a/n;
writeln (g,trunc(j));
close (f);
close (g);
end.