encodeRailFenceCipher = (string, railCount) => {
  const fence = buildFence(railCount);

  const filledFence = fillEncodeFence({
    fence,
    currentRail: 0,
    direction: DIRECTIONS.DOWN,
    chars: string.split(''),
  });

  return filledFence.flat().join('');
}
Encodes the message using Rail Fence Cipher.

@param {string} string - The string to be encoded
@param {number} railCount - The number of rails in a fence
@returns {string} - Encoded string