Post Undeleted by Luis Mendo
4 added 25 characters in body
source | link

MATL, 1016 bytes

t~40+v5MQht~40+v3L)7MQ3L)h

Try it online!Try it online!

Explanation

t     % Implicit input. Duplicate
      % STACK: 'foobar', 'foobar'
~     % Negate. Transforms into an array of zeros
      % STACK: 'foobar', [0 0 0 0 0 0]
40+   % Add 40, element-wise. Gives array containing 40 repeated
      % STACK: 'foobar', [40 40 40 40 40 40]
v     % Concatenate vertically. Gives a two-row char array, with 40 cast into '('
      % STACK: ['foobar'; '((((((']
5M3L)   % Remove last element. Converts to row vector
      % STACK: 'f(o(o(b(a(r'
7M    % Push array containing 40 again
      % STACK: ['foobar'; '('f(o(o(b(a(']r', [40 40 40 40 40 40]
Q     % Add 1, element-wise 
      % STACK: ['foobar'; '('f(o(o(b(a(']r', [41 41 41 41 41 41]
h     % Concatenate horizontally. The two-row array is read in column-major order,
      % andwith 41 is cast into ')'
      % STACK: 'f(o(o(b(a(r())))))'
      % Implicit display

MATL, 10 bytes

t~40+v5MQh

Try it online!

Explanation

t     % Implicit input. Duplicate
      % STACK: 'foobar', 'foobar'
~     % Negate. Transforms into an array of zeros
      % STACK: 'foobar', [0 0 0 0 0 0]
40+   % Add 40, element-wise. Gives array containing 40 repeated
      % STACK: 'foobar', [40 40 40 40 40 40]
v     % Concatenate vertically. Gives a two-row char array, with 40 cast into '('
      % STACK: ['foobar'; '((((((']
5M    % Push array containing 40 again
      % STACK: ['foobar'; '(((((('], [40 40 40 40 40 40]
Q     % Add 1, element-wise 
      % STACK: ['foobar'; '(((((('], [41 41 41 41 41 41]
h     % Concatenate horizontally. The two-row array is read in column-major order,
      % and 41 is cast into ')'
      % STACK: 'f(o(o(b(a(r())))))'
      % Implicit display

MATL, 16 bytes

t~40+v3L)7MQ3L)h

Try it online!

Explanation

t     % Implicit input. Duplicate
      % STACK: 'foobar', 'foobar'
~     % Negate. Transforms into an array of zeros
      % STACK: 'foobar', [0 0 0 0 0 0]
40+   % Add 40, element-wise. Gives array containing 40 repeated
      % STACK: 'foobar', [40 40 40 40 40 40]
v     % Concatenate vertically. Gives a two-row char array, with 40 cast into '('
      % STACK: ['foobar'; '((((((']
3L)   % Remove last element. Converts to row vector
      % STACK: 'f(o(o(b(a(r'
7M    % Push array containing 40 again
      % STACK: 'f(o(o(b(a(r', [40 40 40 40 40 40]
Q     % Add 1, element-wise 
      % STACK: 'f(o(o(b(a(r', [41 41 41 41 41 41]
h     % Concatenate horizontally, with 41 cast into ')'
      % STACK: 'f(o(o(b(a(r)))))'
      % Implicit display
    Post Deleted by Luis Mendo
3 deleted 2 characters in body; added 15 characters in body
source | link

MATL, 10 bytes

t~40+v5MQh

Try it online!

Explanation

t     % Implicit input. Duplicate
      % STACK: 'foobar', 'foobar'
~     % Negate. Transforms into an array of zeros
      % STACK: 'foobar', '[0[0 0 0 0 0 0]
40+   % Add 40, element-wise. Gives array containing 40 repeated
      % STACK: 'foobar', '[40[40 40 40 40 40 40]
v     % Concatenate vertically. Gives a two-row char array, with 40 cast into '('
      % STACK: ['foobar'; '((((((']
5M    % Push array containing 40 again
      % STACK: ['foobar'; '(((((('], [40 40 40 40 40 40]
Q     % Add 1, element-wise 
      % STACK: ['foobar'; '(((((('], [41 41 41 41 41 41]
h     % Concatenate horizontally. The two-row array is read in column-major order,
      % and 41 is cast into ')'
      % STACK: 'f(o(o(b(a(r())))))'
      % Implicit display

MATL, 10 bytes

t~40+v5MQh

Try it online!

Explanation

t     % Implicit input. Duplicate
      % STACK: 'foobar', 'foobar'
~     % Negate. Transforms into an array of zeros
      % STACK: 'foobar', '[0 0 0 0 0 0]
40+   % Add 40, element-wise. Gives array containing 40 repeated
      % STACK: 'foobar', '[40 40 40 40 40 40]
v     % Concatenate vertically. Gives a two-row char array, with 40 cast into '('
      % STACK: ['foobar'; '((((((']
5M    % Push array containing 40 again
      % STACK: ['foobar'; '(((((('], [40 40 40 40 40 40]
Q     % Add 1
      % STACK: ['foobar'; '(((((('], [41 41 41 41 41 41]
h     % Concatenate horizontally. The two-row array is read in column-major order,
      % and 41 is cast into ')'
      % STACK: 'f(o(o(b(a(r())))))'
      % Implicit display

MATL, 10 bytes

t~40+v5MQh

Try it online!

Explanation

t     % Implicit input. Duplicate
      % STACK: 'foobar', 'foobar'
~     % Negate. Transforms into an array of zeros
      % STACK: 'foobar', [0 0 0 0 0 0]
40+   % Add 40, element-wise. Gives array containing 40 repeated
      % STACK: 'foobar', [40 40 40 40 40 40]
v     % Concatenate vertically. Gives a two-row char array, with 40 cast into '('
      % STACK: ['foobar'; '((((((']
5M    % Push array containing 40 again
      % STACK: ['foobar'; '(((((('], [40 40 40 40 40 40]
Q     % Add 1, element-wise 
      % STACK: ['foobar'; '(((((('], [41 41 41 41 41 41]
h     % Concatenate horizontally. The two-row array is read in column-major order,
      % and 41 is cast into ')'
      % STACK: 'f(o(o(b(a(r())))))'
      % Implicit display
2 added 402 characters in body
source | link

MATL, 10 bytes

t~40+v5MQh

Try it online!

Explanation

t     % Implicit input. Duplicate
      % STACK: 'foobar', 'foobar'
~     % Negate. Transforms into an array of zeros
      % STACK: 'foobar', '[0 0 0 0 0 0]
40+   % Add 40, element-wise. Gives array containing 40 repeated
      % STACK: 'foobar', '[40 40 40 40 40 40]
v     % Concatenate vertically. Gives a two-row char array, with 40 cast into '('
      % STACK: ['foobar'; '((((((']
5M    % Push array containing 40 again
      % STACK: ['foobar'; '(((((('], [40 40 40 40 40 40]
Q     % Add 1
      % STACK: ['foobar'; '(((((('], [41 41 41 41 41 41]
h     % Concatenate horizontally, reading. theThe two-row array is read in column -major order,
      % and 41 is cast into ')'
      % STACK: 'f(o(o(b(a(r())))))'
      % Implicit display

MATL, 10 bytes

t~40+v5MQh

Try it online!

Explanation

t     % Implicit input. Duplicate
~     % Negate. Transforms into an array of zeros
40+   % Add 40, element-wise. Gives array containing 40 repeated
v     % Concatenate vertically. Gives two-row char array
5M    % Push array containing 40 again
Q     % Add 1
h     % Concatenate horizontally, reading the two-row array in column major order
      % Implicit display

MATL, 10 bytes

t~40+v5MQh

Try it online!

Explanation

t     % Implicit input. Duplicate
      % STACK: 'foobar', 'foobar'
~     % Negate. Transforms into an array of zeros
      % STACK: 'foobar', '[0 0 0 0 0 0]
40+   % Add 40, element-wise. Gives array containing 40 repeated
      % STACK: 'foobar', '[40 40 40 40 40 40]
v     % Concatenate vertically. Gives a two-row char array, with 40 cast into '('
      % STACK: ['foobar'; '((((((']
5M    % Push array containing 40 again
      % STACK: ['foobar'; '(((((('], [40 40 40 40 40 40]
Q     % Add 1
      % STACK: ['foobar'; '(((((('], [41 41 41 41 41 41]
h     % Concatenate horizontally. The two-row array is read in column-major order,
      % and 41 is cast into ')'
      % STACK: 'f(o(o(b(a(r())))))'
      % Implicit display
1
source | link