//PascalABC.NET 3.1 сборка 1219 begin var s := ReadString('s ='); var t := s.MatchValues('[0-9]+').Aggregate(0, (s, x)-> s + StrToInt(x)); var t1 := s.MatchValues('[A-Z]').Count; Println(t, t1); end.
или
var s: string; i, sum, k: integer;
begin readln(s); for i := 1 to Length(s) do begin if s[i] in '0123456789' then sum := sum + StrToInt(s[i]) else if s[i] in '' then k := k + 1; end; writeln(sum, ' ', k); end.
begin
var s := ReadString('s =');
var t := s.MatchValues('[0-9]+').Aggregate(0, (s, x)-> s + StrToInt(x));
var t1 := s.MatchValues('[A-Z]').Count;
Println(t, t1);
end.
или
var
s: string;
i, sum, k: integer;
begin
readln(s);
for i := 1 to Length(s) do
begin
if s[i] in '0123456789' then sum := sum + StrToInt(s[i])
else if s[i] in '' then k := k + 1;
end;
writeln(sum, ' ', k);
end.