Pagini recente » Cod sursa (job #124703) | Cod sursa (job #2355400) | Cod sursa (job #167915) | Cod sursa (job #1867364) | Cod sursa (job #277372)
Cod sursa(job #277372)
var a,b:text;
lentotal,nrcuv,i,j,n,m:longint;
arie,str:string;
begin
//WoooOOOOoooOOOooo!
assign(a,'text.in'); reset(a);
assign(b,'text.out'); rewrite(b);
while not EOF(a) do begin
i:=i+1;
read(a,arie[i]);
end;
i:=i+1;
arie[i]:=' ';
if arie[1] <> ' ' then begin
j:=0;
nrcuv:=0; str:='';
repeat
j:=j + 1;
if (upcase(arie[j]) >= 'A') AND (upcase(arie[j]) <= 'Z') then
str:=str+ arie[j];
if arie[j+1] = ' ' then begin nrcuv:=nrcuv+1;
lentotal:=lentotal+length(str);writeln(str, ' ' , nrcuv);
str:='';
end;
until j = i;
write(b,lentotal div nrcuv);
end
else begin
write (b,'0');
end;
close(a); close(b);
end.