===== PascalABC.NET =====
begin
var p: set of char := ['-', '"', '''', ':', ';', ',',
'?', '!', '(', ')', '.'];
var s:= ReadlnString('Вводите:');
var (a, i) := (s.ToWords, 0);
while i < a.High do
if a[i+1][1] in p then
a[i] += a[i+1];
a[i+1] := '';
i += 2
end
else
i += 1
end;
s:= a.Where(p -> p.Length > 0).JoinIntoString;
Writeln(s)
end.
===== PascalABC.NET =====
begin
var p: set of char := ['-', '"', '''', ':', ';', ',',
'?', '!', '(', ')', '.'];
var s:= ReadlnString('Вводите:');
var (a, i) := (s.ToWords, 0);
while i < a.High do
begin
if a[i+1][1] in p then
begin
a[i] += a[i+1];
a[i+1] := '';
i += 2
end
else
i += 1
end;
s:= a.Where(p -> p.Length > 0).JoinIntoString;
Writeln(s)
end.