编辑代码

const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void (async function () {
  const heights = (await readline()).split(" ").map(Number);
  let i = 0,
    j = heights.length - 1;
  let max = 0;
  while (i < j) {
    let x = j - i;
    if (heights[i] > heights[j]) {
      max = Math.max(max, heights[j] * x);
      j--;
    } else {
      max = Math.max(max, heights[i] * x);
      i++;
    }
  }
  console.log(max);
})();