1.var s,s1,s2:string;i,a,sum:integer;beginreadln(s);s1:=' ';s2:='*';sum:=0;for i:=1 to length(s) doif pos(s1,s) mod 2=1 then beginsum:=sum+1;insert(s2,s,pos(s1,s));delete(s,pos(s1,s),1);end;writeln(sum);writeln(s);end.var s, s1, s2: string; i, a, sum: integer;
begin readln(s); s1 := ' '; s2 := '*'; sum := 0; for i := 1 to length(s) do if pos(s1, s) mod 2 = 1 then begin sum := sum + 1; insert(s2, s, pos(s1, s)); delete(s, pos(s1, s), 1); end; writeln(sum); writeln(s);end.
2.var s, s1, s2: string; i, a: integer;
begin readln(s); if length(s) mod 4 = 0 then begin for i := 1 to length(s) do begin if (i mod 4) = 1 then begin s1 := copy(s, i, 1); s2 := copy(s, i + 3, 1); Delete(s, i, 1); Delete(s, i + 2, 1); insert(s2, s, i); insert(s1, s, i + 3); end; if (i mod 4) = 2 then begin s1 := copy(s, i, 1); s2 := copy(s, i + 1, 1); Delete(s, i, 1); Delete(s, i, 1); insert(s2, s, i); insert(s1, s, i+1); end; end; end; writeln(s);end.