var Digits:set of '0'..'9';
st:string;
i,s,t,t1:integer;
Begin
read(st)
for i := 1 to length(st) do begin
if not (st[i] in Digits) then begin
s:=s+t;
t:=0;
end
else begin
t1:=integer(st[i]);
t:=t*10+t1;
end;
end;
writeln('s=',s)
End.
на руби куда легчеst=gets.to_s
st=st.gsub(/\D+/,',')
a=(st.split(","))
s=0
a.each_index do |i|
a[i]=a[i].to_i
s+=a[i]
end
p a
p s