Pagini recente » Cod sursa (job #867864) | Istoria paginii runda/simulare_oji_2023_clasa_10_11_martie/clasament | Probleme de Taietura | Cod sursa (job #1784489) | Cod sursa (job #678051)
Cod sursa(job #678051)
program text_infoarena;
type sir = array[1..100000] of char;
var a:sir;
i,n:longint;
f,g:text;
lungime,nr_cuvinte:integer;
begin
assign(f,'text.in'); reset(f);
i:=1;
while not eof(f) do
begin
read(f,a[i]);
inc(i);
end;
close(f);
n:=i-1;
for i:=1 to n do begin
a[i]:=upcase(a[i]);
if not (a[i] in ['A'..'Z','0'..'9']) then a[i]:=' ';
end;
nr_cuvinte:=0;
lungime:=0;
for i:=1 to n do begin
if (a[i] in ['A'..'Z','0'..'9']) then inc(lungime);
if ((a[i] in ['A'..'Z','0'..'9']) and (a[i+1]=' ')) then inc(nr_cuvinte);
end;
assign(g,'text.out'); rewrite(g);
write(g,lungime div nr_cuvinte);
close(g);
end.